Class: SolidusBolt::Users::SyncAddressesService
- Inherits:
-
BaseService
- Object
- BaseService
- SolidusBolt::Users::SyncAddressesService
- Defined in:
- app/services/solidus_bolt/users/sync_addresses_service.rb
Instance Attribute Summary collapse
-
#access_token ⇒ Object
readonly
Returns the value of attribute access_token.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(user:, access_token:) ⇒ SyncAddressesService
constructor
A new instance of SyncAddressesService.
Methods inherited from BaseService
Constructor Details
#initialize(user:, access_token:) ⇒ SyncAddressesService
Returns a new instance of SyncAddressesService.
8 9 10 11 12 |
# File 'app/services/solidus_bolt/users/sync_addresses_service.rb', line 8 def initialize(user:, access_token:) @access_token = access_token @user = user super end |
Instance Attribute Details
#access_token ⇒ Object (readonly)
Returns the value of attribute access_token.
6 7 8 |
# File 'app/services/solidus_bolt/users/sync_addresses_service.rb', line 6 def access_token @access_token end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
6 7 8 |
# File 'app/services/solidus_bolt/users/sync_addresses_service.rb', line 6 def user @user end |
Instance Method Details
#call ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'app/services/solidus_bolt/users/sync_addresses_service.rb', line 14 def call return if user.nil? || access_token.nil? bolt_addresses.each do |bolt_address| default = bolt_address['default'] address = convert_to_solidus(bolt_address) user.save_in_address_book(address, default, :shipping) user.save_in_address_book(address, default, :billing) end end |