Class: AdvancedBilling::CustomerChange
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::CustomerChange
- Defined in:
- lib/advanced_billing/models/customer_change.rb
Overview
CustomerChange Model.
Instance Attribute Summary collapse
-
#billing_address ⇒ CustomerBillingAddressChange
TODO: Write general description for this method.
-
#custom_fields ⇒ CustomerCustomFieldsChange
TODO: Write general description for this method.
-
#payer ⇒ CustomerPayerChange
TODO: Write general description for this method.
-
#shipping_address ⇒ CustomerShippingAddressChange
TODO: Write general description for this method.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(payer = SKIP, shipping_address = SKIP, billing_address = SKIP, custom_fields = SKIP) ⇒ CustomerChange
constructor
A new instance of CustomerChange.
Methods inherited from BaseModel
Constructor Details
#initialize(payer = SKIP, shipping_address = SKIP, billing_address = SKIP, custom_fields = SKIP) ⇒ CustomerChange
Returns a new instance of CustomerChange.
53 54 55 56 57 58 59 |
# File 'lib/advanced_billing/models/customer_change.rb', line 53 def initialize(payer = SKIP, shipping_address = SKIP, billing_address = SKIP, custom_fields = SKIP) @payer = payer unless payer == SKIP @shipping_address = shipping_address unless shipping_address == SKIP @billing_address = billing_address unless billing_address == SKIP @custom_fields = custom_fields unless custom_fields == SKIP end |
Instance Attribute Details
#billing_address ⇒ CustomerBillingAddressChange
TODO: Write general description for this method
22 23 24 |
# File 'lib/advanced_billing/models/customer_change.rb', line 22 def billing_address @billing_address end |
#custom_fields ⇒ CustomerCustomFieldsChange
TODO: Write general description for this method
26 27 28 |
# File 'lib/advanced_billing/models/customer_change.rb', line 26 def custom_fields @custom_fields end |
#payer ⇒ CustomerPayerChange
TODO: Write general description for this method
14 15 16 |
# File 'lib/advanced_billing/models/customer_change.rb', line 14 def payer @payer end |
#shipping_address ⇒ CustomerShippingAddressChange
TODO: Write general description for this method
18 19 20 |
# File 'lib/advanced_billing/models/customer_change.rb', line 18 def shipping_address @shipping_address end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/advanced_billing/models/customer_change.rb', line 62 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. payer = CustomerPayerChange.from_hash(hash['payer']) if hash['payer'] shipping_address = CustomerShippingAddressChange.from_hash(hash['shipping_address']) if hash['shipping_address'] billing_address = CustomerBillingAddressChange.from_hash(hash['billing_address']) if hash['billing_address'] custom_fields = CustomerCustomFieldsChange.from_hash(hash['custom_fields']) if hash['custom_fields'] # Create object from extracted values. CustomerChange.new(payer, shipping_address, billing_address, custom_fields) end |
.names ⇒ Object
A mapping from model property names to API property names.
29 30 31 32 33 34 35 36 |
# File 'lib/advanced_billing/models/customer_change.rb', line 29 def self.names @_hash = {} if @_hash.nil? @_hash['payer'] = 'payer' @_hash['shipping_address'] = 'shipping_address' @_hash['billing_address'] = 'billing_address' @_hash['custom_fields'] = 'custom_fields' @_hash end |
.nullables ⇒ Object
An array for nullable fields
49 50 51 |
# File 'lib/advanced_billing/models/customer_change.rb', line 49 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
39 40 41 42 43 44 45 46 |
# File 'lib/advanced_billing/models/customer_change.rb', line 39 def self.optionals %w[ payer shipping_address billing_address custom_fields ] end |