Class: ShellCardManagementApIs::Address

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/shell_card_management_ap_is/models/address.rb

Overview

Address Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(address_id = SKIP, address_line1 = SKIP, address_line2 = SKIP, address_line3 = SKIP, zip_code = SKIP, city = SKIP, region_id = SKIP, country_iso_code = SKIP, country = SKIP, telephone = SKIP, email_address = SKIP, fax = SKIP) ⇒ Address

Returns a new instance of Address.



114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/shell_card_management_ap_is/models/address.rb', line 114

def initialize(address_id = SKIP, address_line1 = SKIP,
               address_line2 = SKIP, address_line3 = SKIP, zip_code = SKIP,
               city = SKIP, region_id = SKIP, country_iso_code = SKIP,
               country = SKIP, telephone = SKIP, email_address = SKIP,
               fax = SKIP)
  @address_id = address_id unless address_id == SKIP
  @address_line1 = address_line1 unless address_line1 == SKIP
  @address_line2 = address_line2 unless address_line2 == SKIP
  @address_line3 = address_line3 unless address_line3 == SKIP
  @zip_code = zip_code unless zip_code == SKIP
  @city = city unless city == SKIP
  @region_id = region_id unless region_id == SKIP
  @country_iso_code = country_iso_code unless country_iso_code == SKIP
  @country = country unless country == SKIP
  @telephone = telephone unless telephone == SKIP
  @email_address = email_address unless email_address == SKIP
  @fax = fax unless fax == SKIP
end

Instance Attribute Details

#address_idInteger

Address Id in cards platform.

Returns:

  • (Integer)


14
15
16
# File 'lib/shell_card_management_ap_is/models/address.rb', line 14

def address_id
  @address_id
end

#address_line1String

Address line1

Returns:

  • (String)


18
19
20
# File 'lib/shell_card_management_ap_is/models/address.rb', line 18

def address_line1
  @address_line1
end

#address_line2String

Address line2

Returns:

  • (String)


22
23
24
# File 'lib/shell_card_management_ap_is/models/address.rb', line 22

def address_line2
  @address_line2
end

#address_line3String

AddressLine3

Returns:

  • (String)


26
27
28
# File 'lib/shell_card_management_ap_is/models/address.rb', line 26

def address_line3
  @address_line3
end

#cityString

City

Returns:

  • (String)


34
35
36
# File 'lib/shell_card_management_ap_is/models/address.rb', line 34

def city
  @city
end

#countryString

Country for the address

Returns:

  • (String)


46
47
48
# File 'lib/shell_card_management_ap_is/models/address.rb', line 46

def country
  @country
end

#country_iso_codeString

Country ISO code of the address

Returns:

  • (String)


42
43
44
# File 'lib/shell_card_management_ap_is/models/address.rb', line 42

def country_iso_code
  @country_iso_code
end

#email_addressString

Email address of the address contact

Returns:

  • (String)


54
55
56
# File 'lib/shell_card_management_ap_is/models/address.rb', line 54

def email_address
  @email_address
end

#faxString

Fax number of the address contact

Returns:

  • (String)


58
59
60
# File 'lib/shell_card_management_ap_is/models/address.rb', line 58

def fax
  @fax
end

#region_idInteger

Region Id of the address.

Returns:

  • (Integer)


38
39
40
# File 'lib/shell_card_management_ap_is/models/address.rb', line 38

def region_id
  @region_id
end

#telephoneString

Telephone number of the address contact

Returns:

  • (String)


50
51
52
# File 'lib/shell_card_management_ap_is/models/address.rb', line 50

def telephone
  @telephone
end

#zip_codeString

ZipCode

Returns:

  • (String)


30
31
32
# File 'lib/shell_card_management_ap_is/models/address.rb', line 30

def zip_code
  @zip_code
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# File 'lib/shell_card_management_ap_is/models/address.rb', line 134

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  address_id = hash.key?('AddressId') ? hash['AddressId'] : SKIP
  address_line1 = hash.key?('AddressLine1') ? hash['AddressLine1'] : SKIP
  address_line2 = hash.key?('AddressLine2') ? hash['AddressLine2'] : SKIP
  address_line3 = hash.key?('AddressLine3') ? hash['AddressLine3'] : SKIP
  zip_code = hash.key?('ZipCode') ? hash['ZipCode'] : SKIP
  city = hash.key?('City') ? hash['City'] : SKIP
  region_id = hash.key?('RegionId') ? hash['RegionId'] : SKIP
  country_iso_code =
    hash.key?('CountryISOCode') ? hash['CountryISOCode'] : SKIP
  country = hash.key?('Country') ? hash['Country'] : SKIP
  telephone = hash.key?('Telephone') ? hash['Telephone'] : SKIP
  email_address = hash.key?('EmailAddress') ? hash['EmailAddress'] : SKIP
  fax = hash.key?('Fax') ? hash['Fax'] : SKIP

  # Create object from extracted values.
  Address.new(address_id,
              address_line1,
              address_line2,
              address_line3,
              zip_code,
              city,
              region_id,
              country_iso_code,
              country,
              telephone,
              email_address,
              fax)
end

.namesObject

A mapping from model property names to API property names.



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/shell_card_management_ap_is/models/address.rb', line 61

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['address_id'] = 'AddressId'
  @_hash['address_line1'] = 'AddressLine1'
  @_hash['address_line2'] = 'AddressLine2'
  @_hash['address_line3'] = 'AddressLine3'
  @_hash['zip_code'] = 'ZipCode'
  @_hash['city'] = 'City'
  @_hash['region_id'] = 'RegionId'
  @_hash['country_iso_code'] = 'CountryISOCode'
  @_hash['country'] = 'Country'
  @_hash['telephone'] = 'Telephone'
  @_hash['email_address'] = 'EmailAddress'
  @_hash['fax'] = 'Fax'
  @_hash
end

.nullablesObject

An array for nullable fields



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/shell_card_management_ap_is/models/address.rb', line 97

def self.nullables
  %w[
    address_id
    address_line1
    address_line2
    address_line3
    zip_code
    city
    region_id
    country_iso_code
    country
    telephone
    email_address
    fax
  ]
end

.optionalsObject

An array for optional fields



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/shell_card_management_ap_is/models/address.rb', line 79

def self.optionals
  %w[
    address_id
    address_line1
    address_line2
    address_line3
    zip_code
    city
    region_id
    country_iso_code
    country
    telephone
    email_address
    fax
  ]
end