Class: AdvancedBilling::InvoicePayer
- Defined in:
- lib/advanced_billing/models/invoice_payer.rb
Overview
InvoicePayer Model.
Instance Attribute Summary collapse
-
#chargify_id ⇒ Integer
TODO: Write general description for this method.
-
#email ⇒ String
TODO: Write general description for this method.
-
#first_name ⇒ String
TODO: Write general description for this method.
-
#last_name ⇒ String
TODO: Write general description for this method.
-
#organization ⇒ String
TODO: Write general description for this method.
-
#vat_number ⇒ String
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.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(chargify_id: SKIP, first_name: SKIP, last_name: SKIP, organization: SKIP, email: SKIP, vat_number: SKIP, additional_properties: {}) ⇒ InvoicePayer
constructor
A new instance of InvoicePayer.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(chargify_id: SKIP, first_name: SKIP, last_name: SKIP, organization: SKIP, email: SKIP, vat_number: SKIP, additional_properties: {}) ⇒ InvoicePayer
Returns a new instance of InvoicePayer.
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/advanced_billing/models/invoice_payer.rb', line 68 def initialize(chargify_id: SKIP, first_name: SKIP, last_name: SKIP, organization: SKIP, email: SKIP, vat_number: SKIP, additional_properties: {}) # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end @chargify_id = chargify_id unless chargify_id == SKIP @first_name = first_name unless first_name == SKIP @last_name = last_name unless last_name == SKIP @organization = organization unless organization == SKIP @email = email unless email == SKIP @vat_number = vat_number unless vat_number == SKIP end |
Instance Attribute Details
#chargify_id ⇒ Integer
TODO: Write general description for this method
14 15 16 |
# File 'lib/advanced_billing/models/invoice_payer.rb', line 14 def chargify_id @chargify_id end |
#email ⇒ String
TODO: Write general description for this method
30 31 32 |
# File 'lib/advanced_billing/models/invoice_payer.rb', line 30 def email @email end |
#first_name ⇒ String
TODO: Write general description for this method
18 19 20 |
# File 'lib/advanced_billing/models/invoice_payer.rb', line 18 def first_name @first_name end |
#last_name ⇒ String
TODO: Write general description for this method
22 23 24 |
# File 'lib/advanced_billing/models/invoice_payer.rb', line 22 def last_name @last_name end |
#organization ⇒ String
TODO: Write general description for this method
26 27 28 |
# File 'lib/advanced_billing/models/invoice_payer.rb', line 26 def organization @organization end |
#vat_number ⇒ String
TODO: Write general description for this method
34 35 36 |
# File 'lib/advanced_billing/models/invoice_payer.rb', line 34 def vat_number @vat_number end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/advanced_billing/models/invoice_payer.rb', line 85 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. chargify_id = hash.key?('chargify_id') ? hash['chargify_id'] : SKIP first_name = hash.key?('first_name') ? hash['first_name'] : SKIP last_name = hash.key?('last_name') ? hash['last_name'] : SKIP organization = hash.key?('organization') ? hash['organization'] : SKIP email = hash.key?('email') ? hash['email'] : SKIP vat_number = hash.key?('vat_number') ? hash['vat_number'] : SKIP # Clean out expected properties from Hash. additional_properties = hash.reject { |k, _| names.value?(k) } # Create object from extracted values. InvoicePayer.new(chargify_id: chargify_id, first_name: first_name, last_name: last_name, organization: organization, email: email, vat_number: vat_number, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/advanced_billing/models/invoice_payer.rb', line 37 def self.names @_hash = {} if @_hash.nil? @_hash['chargify_id'] = 'chargify_id' @_hash['first_name'] = 'first_name' @_hash['last_name'] = 'last_name' @_hash['organization'] = 'organization' @_hash['email'] = 'email' @_hash['vat_number'] = 'vat_number' @_hash end |
.nullables ⇒ Object
An array for nullable fields
61 62 63 64 65 66 |
# File 'lib/advanced_billing/models/invoice_payer.rb', line 61 def self.nullables %w[ organization vat_number ] end |
.optionals ⇒ Object
An array for optional fields
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/advanced_billing/models/invoice_payer.rb', line 49 def self.optionals %w[ chargify_id first_name last_name organization email vat_number ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
111 112 113 114 115 116 117 |
# File 'lib/advanced_billing/models/invoice_payer.rb', line 111 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |