Class: AdvancedBilling::OrganizationAddress

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

Overview

OrganizationAddress Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(street = SKIP, line2 = SKIP, city = SKIP, state = SKIP, zip = SKIP, country = SKIP, name = SKIP, phone = SKIP) ⇒ OrganizationAddress

Returns a new instance of OrganizationAddress.



86
87
88
89
90
91
92
93
94
95
96
# File 'lib/advanced_billing/models/organization_address.rb', line 86

def initialize(street = SKIP, line2 = SKIP, city = SKIP, state = SKIP,
               zip = SKIP, country = SKIP, name = SKIP, phone = SKIP)
  @street = street unless street == SKIP
  @line2 = line2 unless line2 == SKIP
  @city = city unless city == SKIP
  @state = state unless state == SKIP
  @zip = zip unless zip == SKIP
  @country = country unless country == SKIP
  @name = name unless name == SKIP
  @phone = phone unless phone == SKIP
end

Instance Attribute Details

#cityString

TODO: Write general description for this method

Returns:

  • (String)


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

def city
  @city
end

#countryString

TODO: Write general description for this method

Returns:

  • (String)


34
35
36
# File 'lib/advanced_billing/models/organization_address.rb', line 34

def country
  @country
end

#line2String

TODO: Write general description for this method

Returns:

  • (String)


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

def line2
  @line2
end

#nameString

TODO: Write general description for this method

Returns:

  • (String)


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

def name
  @name
end

#phoneString

TODO: Write general description for this method

Returns:

  • (String)


42
43
44
# File 'lib/advanced_billing/models/organization_address.rb', line 42

def phone
  @phone
end

#stateString

TODO: Write general description for this method

Returns:

  • (String)


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

def state
  @state
end

#streetString

TODO: Write general description for this method

Returns:

  • (String)


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

def street
  @street
end

#zipString

TODO: Write general description for this method

Returns:

  • (String)


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

def zip
  @zip
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/advanced_billing/models/organization_address.rb', line 99

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.

  street = hash.key?('street') ? hash['street'] : SKIP
  line2 = hash.key?('line2') ? hash['line2'] : SKIP
  city = hash.key?('city') ? hash['city'] : SKIP
  state = hash.key?('state') ? hash['state'] : SKIP
  zip = hash.key?('zip') ? hash['zip'] : SKIP
  country = hash.key?('country') ? hash['country'] : SKIP
  name = hash.key?('name') ? hash['name'] : SKIP
  phone = hash.key?('phone') ? hash['phone'] : SKIP

  # Create object from extracted values.

  OrganizationAddress.new(street,
                          line2,
                          city,
                          state,
                          zip,
                          country,
                          name,
                          phone)
end

.namesObject

A mapping from model property names to API property names.



45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/advanced_billing/models/organization_address.rb', line 45

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['street'] = 'street'
  @_hash['line2'] = 'line2'
  @_hash['city'] = 'city'
  @_hash['state'] = 'state'
  @_hash['zip'] = 'zip'
  @_hash['country'] = 'country'
  @_hash['name'] = 'name'
  @_hash['phone'] = 'phone'
  @_hash
end

.nullablesObject

An array for nullable fields



73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/advanced_billing/models/organization_address.rb', line 73

def self.nullables
  %w[
    street
    line2
    city
    state
    zip
    country
    name
    phone
  ]
end

.optionalsObject

An array for optional fields



59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/advanced_billing/models/organization_address.rb', line 59

def self.optionals
  %w[
    street
    line2
    city
    state
    zip
    country
    name
    phone
  ]
end