Class: ReviewService::SecondHalfStep
- Inherits:
-
ApplicationService
- Object
- ApplicationService
- ReviewService::SecondHalfStep
- Defined in:
- app/services/review_service/second_half_step.rb
Instance Attribute Summary collapse
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
Attributes inherited from ApplicationService
Instance Method Summary collapse
- #execute! ⇒ Object
-
#initialize(review_id, email, password) ⇒ SecondHalfStep
constructor
A new instance of SecondHalfStep.
- #next_step_path ⇒ Object
Methods inherited from ApplicationService
Constructor Details
#initialize(review_id, email, password) ⇒ SecondHalfStep
Returns a new instance of SecondHalfStep.
12 13 14 15 16 |
# File 'app/services/review_service/second_half_step.rb', line 12 def initialize(review_id, email, password) self.object = Review.find(review_id) @email = email @password = password end |
Instance Attribute Details
#email ⇒ Object (readonly)
Returns the value of attribute email.
8 9 10 |
# File 'app/services/review_service/second_half_step.rb', line 8 def email @email end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
8 9 10 |
# File 'app/services/review_service/second_half_step.rb', line 8 def password @password end |
Instance Method Details
#execute! ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/services/review_service/second_half_step.rb', line 18 def execute! success = false ActiveRecord::Base.transaction do registration_service = UserRegistration::UsingPassword.new(payload) unless registration_service.save object.errors.add(:base, registration_service.) raise ActiveRecord::ActiveRecordError, registration_service. end self.user = registration_service.user update_reservation! update_review! ::Reward.create!(points_total: 10, points_pending: 0, description: 'Becoming hungry hub member', user_id: user.id, redeemed: false, country_id: user.country_id) success = true end raise ActiveRecord::ActiveRecordError unless success ServiceResult.new data: user end |
#next_step_path ⇒ Object
43 44 45 46 |
# File 'app/services/review_service/second_half_step.rb', line 43 def next_step_path url_helper.booking_review_landing_page_path(review_id: object.encrypted_id, booking_id: reservation.encrypted_id, locale: MyLocaleManager.normalize_locale, customer: :member) end |