Class: AdvancedBilling::Customer1
- Defined in:
- lib/advanced_billing/models/customer1.rb
Overview
Customer1 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.
-
#reference ⇒ 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, reference = SKIP) ⇒ Customer1
constructor
A new instance of Customer1.
Methods inherited from BaseModel
Constructor Details
#initialize(chargify_id = SKIP, first_name = SKIP, last_name = SKIP, organization = SKIP, email = SKIP, vat_number = SKIP, reference = SKIP) ⇒ Customer1
Returns a new instance of Customer1.
75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/advanced_billing/models/customer1.rb', line 75 def initialize(chargify_id = SKIP, first_name = SKIP, last_name = SKIP, organization = SKIP, email = SKIP, vat_number = SKIP, reference = SKIP) @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 @reference = reference unless reference == SKIP end |
Instance Attribute Details
#chargify_id ⇒ Integer
TODO: Write general description for this method
14 15 16 |
# File 'lib/advanced_billing/models/customer1.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/customer1.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/customer1.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/customer1.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/customer1.rb', line 26 def organization @organization end |
#reference ⇒ String
TODO: Write general description for this method
38 39 40 |
# File 'lib/advanced_billing/models/customer1.rb', line 38 def reference @reference end |
#vat_number ⇒ String
TODO: Write general description for this method
34 35 36 |
# File 'lib/advanced_billing/models/customer1.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.
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/advanced_billing/models/customer1.rb', line 88 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 reference = hash.key?('reference') ? hash['reference'] : SKIP # Create object from extracted values. Customer1.new(chargify_id, first_name, last_name, organization, email, vat_number, reference) end |
.names ⇒ Object
A mapping from model property names to API property names.
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/advanced_billing/models/customer1.rb', line 41 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['reference'] = 'reference' @_hash end |
.nullables ⇒ Object
An array for nullable fields
67 68 69 70 71 72 73 |
# File 'lib/advanced_billing/models/customer1.rb', line 67 def self.nullables %w[ organization vat_number reference ] end |
.optionals ⇒ Object
An array for optional fields
54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/advanced_billing/models/customer1.rb', line 54 def self.optionals %w[ chargify_id first_name last_name organization email vat_number reference ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
112 113 114 115 116 117 118 |
# File 'lib/advanced_billing/models/customer1.rb', line 112 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |