Class: AdvancedBilling::Customer1

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/advanced_billing/models/customer1.rb

Overview

Customer1 Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

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_idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


14
15
16
# File 'lib/advanced_billing/models/customer1.rb', line 14

def chargify_id
  @chargify_id
end

#emailString

TODO: Write general description for this method

Returns:

  • (String)


30
31
32
# File 'lib/advanced_billing/models/customer1.rb', line 30

def email
  @email
end

#first_nameString

TODO: Write general description for this method

Returns:

  • (String)


18
19
20
# File 'lib/advanced_billing/models/customer1.rb', line 18

def first_name
  @first_name
end

#last_nameString

TODO: Write general description for this method

Returns:

  • (String)


22
23
24
# File 'lib/advanced_billing/models/customer1.rb', line 22

def last_name
  @last_name
end

#organizationString

TODO: Write general description for this method

Returns:

  • (String)


26
27
28
# File 'lib/advanced_billing/models/customer1.rb', line 26

def organization
  @organization
end

#referenceString

TODO: Write general description for this method

Returns:

  • (String)


38
39
40
# File 'lib/advanced_billing/models/customer1.rb', line 38

def reference
  @reference
end

#vat_numberString

TODO: Write general description for this method

Returns:

  • (String)


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

.namesObject

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

.nullablesObject

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

.optionalsObject

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.

Parameters:

  • The (Customer1 | Hash)

    value against the validation is performed.



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