Class: ShellCardManagementApIs::CardDeliveryAddress

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

Overview

CardDeliveryAddress Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(company_name = nil, address_id = nil, address_line1 = nil, zip_code = nil, country_id = nil, country_iso_code = nil, country = nil, contact_fore_name = SKIP, contact_middle_name = SKIP, contact_last_name = SKIP, contact_title = SKIP, address_line2 = SKIP, address_line3 = SKIP, city = SKIP, region_id = SKIP, region = SKIP) ⇒ CardDeliveryAddress

Returns a new instance of CardDeliveryAddress.



148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/shell_card_management_ap_is/models/card_delivery_address.rb', line 148

def initialize(company_name = nil, address_id = nil, address_line1 = nil,
               zip_code = nil, country_id = nil, country_iso_code = nil,
               country = nil, contact_fore_name = SKIP,
               contact_middle_name = SKIP, contact_last_name = SKIP,
               contact_title = SKIP, address_line2 = SKIP,
               address_line3 = SKIP, city = SKIP, region_id = SKIP,
               region = SKIP)
  @contact_fore_name = contact_fore_name unless contact_fore_name == SKIP
  @contact_middle_name = contact_middle_name unless contact_middle_name == SKIP
  @contact_last_name = contact_last_name unless contact_last_name == SKIP
  @contact_title = contact_title unless contact_title == SKIP
  @company_name = company_name
  @address_id = address_id
  @address_line1 = address_line1
  @address_line2 = address_line2 unless address_line2 == SKIP
  @address_line3 = address_line3 unless address_line3 == SKIP
  @zip_code = zip_code
  @city = city unless city == SKIP
  @region_id = region_id unless region_id == SKIP
  @region = region unless region == SKIP
  @country_id = country_id
  @country_iso_code = country_iso_code
  @country = country
end

Instance Attribute Details

#address_idInteger

Address Id in cards platform.

Returns:

  • (Integer)


40
41
42
# File 'lib/shell_card_management_ap_is/models/card_delivery_address.rb', line 40

def address_id
  @address_id
end

#address_line1String

Address line 1 Mandatory if IsNewDeliveryAddress and OrderReplacement are passed True. Max field length- 40 Note- If the Shell Card Platform configuration is set to clear the personal details captured on card orders, this value will be cleared from the record after processing the request.

Returns:

  • (String)


48
49
50
# File 'lib/shell_card_management_ap_is/models/card_delivery_address.rb', line 48

def address_line1
  @address_line1
end

#address_line2String

Address line 2 Optional Max field length- 40 Note- If the Shell Card Platform configuration is set to clear the personal details captured on card orders, this value will be cleared from the record after processing the request.

Returns:

  • (String)


55
56
57
# File 'lib/shell_card_management_ap_is/models/card_delivery_address.rb', line 55

def address_line2
  @address_line2
end

#address_line3String

Address line Optional Max field length- 40 Note- If the Shell Card Platform configuration is set to clear the personal details captured on card orders, this value will be cleared from the record after processing the request.

Returns:

  • (String)


62
63
64
# File 'lib/shell_card_management_ap_is/models/card_delivery_address.rb', line 62

def address_line3
  @address_line3
end

#cityString

City Max field length- 40 Note- If the Shell Card Platform configuration is set to clear the personal details captured on card orders, this value will be cleared from the record after processing the request.

Returns:

  • (String)


76
77
78
# File 'lib/shell_card_management_ap_is/models/card_delivery_address.rb', line 76

def city
  @city
end

#company_nameString

Company name Mandatory if IsNewDeliveryAddress and OrderReplacement are passed. True, Note- If the Shell Card Platform configuration is set to clear the personal details captured on card orders, this value will be cleared from the record after processing the request.

Returns:

  • (String)


36
37
38
# File 'lib/shell_card_management_ap_is/models/card_delivery_address.rb', line 36

def company_name
  @company_name
end

#contact_fore_nameString

Fore name of the contact person

Returns:

  • (String)


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

def contact_fore_name
  @contact_fore_name
end

#contact_last_nameString

Last name of the contact person

Returns:

  • (String)


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

def contact_last_name
  @contact_last_name
end

#contact_middle_nameString

Middle name of the contact person

Returns:

  • (String)


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

def contact_middle_name
  @contact_middle_name
end

#contact_titleString

Title of the contact person Optional Max field length- 10 Note- If the Shell Card Platform configuration is set to clear the personal details captured on card orders, this value will be cleared from the record after processing the request.

Returns:

  • (String)


29
30
31
# File 'lib/shell_card_management_ap_is/models/card_delivery_address.rb', line 29

def contact_title
  @contact_title
end

#countryString

Country name.

Returns:

  • (String)


102
103
104
# File 'lib/shell_card_management_ap_is/models/card_delivery_address.rb', line 102

def country
  @country
end

#country_idInteger

Country Id in cards platform.

Returns:

  • (Integer)


91
92
93
# File 'lib/shell_card_management_ap_is/models/card_delivery_address.rb', line 91

def country_id
  @country_id
end

#country_iso_codeString

The ISO code of the country. Mandatory if IsNewDeliveryAddress and OrderReplacement are passed. If the option to clear personal details is set in the Shell Card Platform, then this value will be cleared from the record after processing the request .

Returns:

  • (String)


98
99
100
# File 'lib/shell_card_management_ap_is/models/card_delivery_address.rb', line 98

def country_iso_code
  @country_iso_code
end

#regionString

Region Optional When region is passed, Shell Card Platform will look up for the region id for the given region. If the option to clear personal details is set in the Shell Card Platform, then this value will be cleared from the record after processing the request .

Returns:

  • (String)


87
88
89
# File 'lib/shell_card_management_ap_is/models/card_delivery_address.rb', line 87

def region
  @region
end

#region_idInteger

Region Id

Returns:

  • (Integer)


80
81
82
# File 'lib/shell_card_management_ap_is/models/card_delivery_address.rb', line 80

def region_id
  @region_id
end

#zip_codeString

ZIP code Mandatory if IsNewDeliveryAddress and OrderReplacement are passed. True, Max field length- 10 Note- If the Shell Card Platform configuration is set to clear the personal details captured on card orders, this value will be cleared from the record after processing the request.

Returns:

  • (String)


70
71
72
# File 'lib/shell_card_management_ap_is/models/card_delivery_address.rb', line 70

def zip_code
  @zip_code
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
# File 'lib/shell_card_management_ap_is/models/card_delivery_address.rb', line 174

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  company_name = hash.key?('CompanyName') ? hash['CompanyName'] : nil
  address_id = hash.key?('AddressId') ? hash['AddressId'] : nil
  address_line1 = hash.key?('AddressLine1') ? hash['AddressLine1'] : nil
  zip_code = hash.key?('ZipCode') ? hash['ZipCode'] : nil
  country_id = hash.key?('CountryId') ? hash['CountryId'] : nil
  country_iso_code =
    hash.key?('CountryISOCode') ? hash['CountryISOCode'] : nil
  country = hash.key?('Country') ? hash['Country'] : nil
  contact_fore_name =
    hash.key?('ContactForeName') ? hash['ContactForeName'] : SKIP
  contact_middle_name =
    hash.key?('ContactMiddleName') ? hash['ContactMiddleName'] : SKIP
  contact_last_name =
    hash.key?('ContactLastName') ? hash['ContactLastName'] : SKIP
  contact_title = hash.key?('ContactTitle') ? hash['ContactTitle'] : SKIP
  address_line2 = hash.key?('AddressLine2') ? hash['AddressLine2'] : SKIP
  address_line3 = hash.key?('AddressLine3') ? hash['AddressLine3'] : SKIP
  city = hash.key?('City') ? hash['City'] : SKIP
  region_id = hash.key?('RegionId') ? hash['RegionId'] : SKIP
  region = hash.key?('Region') ? hash['Region'] : SKIP

  # Create object from extracted values.
  CardDeliveryAddress.new(company_name,
                          address_id,
                          address_line1,
                          zip_code,
                          country_id,
                          country_iso_code,
                          country,
                          contact_fore_name,
                          contact_middle_name,
                          contact_last_name,
                          contact_title,
                          address_line2,
                          address_line3,
                          city,
                          region_id,
                          region)
end

.namesObject

A mapping from model property names to API property names.



105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/shell_card_management_ap_is/models/card_delivery_address.rb', line 105

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['contact_fore_name'] = 'ContactForeName'
  @_hash['contact_middle_name'] = 'ContactMiddleName'
  @_hash['contact_last_name'] = 'ContactLastName'
  @_hash['contact_title'] = 'ContactTitle'
  @_hash['company_name'] = 'CompanyName'
  @_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['region'] = 'Region'
  @_hash['country_id'] = 'CountryId'
  @_hash['country_iso_code'] = 'CountryISOCode'
  @_hash['country'] = 'Country'
  @_hash
end

.nullablesObject

An array for nullable fields



142
143
144
145
146
# File 'lib/shell_card_management_ap_is/models/card_delivery_address.rb', line 142

def self.nullables
  %w[
    region_id
  ]
end

.optionalsObject

An array for optional fields



127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/shell_card_management_ap_is/models/card_delivery_address.rb', line 127

def self.optionals
  %w[
    contact_fore_name
    contact_middle_name
    contact_last_name
    contact_title
    address_line2
    address_line3
    city
    region_id
    region
  ]
end