Class: Spree::Gateway::BraintreeVzeroBase::Address
- Inherits:
-
Object
- Object
- Spree::Gateway::BraintreeVzeroBase::Address
- Defined in:
- app/models/spree/gateway/braintree_vzero_base/address.rb
Instance Attribute Summary collapse
-
#request ⇒ Object
readonly
Returns the value of attribute request.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
-
#utils ⇒ Object
readonly
Returns the value of attribute utils.
Instance Method Summary collapse
- #create ⇒ Object
- #delete(braintree_address) ⇒ Object
- #find(braintree_address) ⇒ Object
-
#initialize(provider, order) ⇒ Address
constructor
A new instance of Address.
- #update(braintree_address, params) ⇒ Object
Constructor Details
Instance Attribute Details
#request ⇒ Object (readonly)
Returns the value of attribute request.
5 6 7 |
# File 'app/models/spree/gateway/braintree_vzero_base/address.rb', line 5 def request @request end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
5 6 7 |
# File 'app/models/spree/gateway/braintree_vzero_base/address.rb', line 5 def user @user end |
#utils ⇒ Object (readonly)
Returns the value of attribute utils.
5 6 7 |
# File 'app/models/spree/gateway/braintree_vzero_base/address.rb', line 5 def utils @utils end |
Instance Method Details
#create ⇒ Object
13 14 15 |
# File 'app/models/spree/gateway/braintree_vzero_base/address.rb', line 13 def create @request.create(@utils.address_data('billing', utils.order).merge!(customer_id: user.id.to_s)) end |
#delete(braintree_address) ⇒ Object
27 28 29 |
# File 'app/models/spree/gateway/braintree_vzero_base/address.rb', line 27 def delete(braintree_address) @request.delete(user.id.to_s, braintree_address.id.to_s) end |
#find(braintree_address) ⇒ Object
17 18 19 20 21 |
# File 'app/models/spree/gateway/braintree_vzero_base/address.rb', line 17 def find(braintree_address) address_id = braintree_address.try(:id) || braintree_address @request.find(user.id.to_s, address_id.to_s) rescue Braintree::NotFoundError end |
#update(braintree_address, params) ⇒ Object
23 24 25 |
# File 'app/models/spree/gateway/braintree_vzero_base/address.rb', line 23 def update(braintree_address, params) @request.update(user.id.to_s, braintree_address.id.to_s, params) end |