Class: OCI::OspGateway::Models::BillingAddress

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/osp_gateway/models/billing_address.rb

Overview

Billing address details model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ BillingAddress

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash

Options Hash (attributes):

  • :address_key (String)

    The value to assign to the #address_key property

  • :line1 (String)

    The value to assign to the #line1 property

  • :line2 (String)

    The value to assign to the #line2 property

  • :city (String)

    The value to assign to the #city property

  • :country (String)

    The value to assign to the #country property

  • :postal_code (String)

    The value to assign to the #postal_code property

  • :state (String)

    The value to assign to the #state property

  • :email_address (String)

    The value to assign to the #email_address property

  • :company_name (String)

    The value to assign to the #company_name property

  • :first_name (String)

    The value to assign to the #first_name property

  • :last_name (String)

    The value to assign to the #last_name property



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
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
# File 'lib/oci/osp_gateway/models/billing_address.rb', line 109

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  self.address_key = attributes[:'addressKey'] if attributes[:'addressKey']

  raise 'You cannot provide both :addressKey and :address_key' if attributes.key?(:'addressKey') && attributes.key?(:'address_key')

  self.address_key = attributes[:'address_key'] if attributes[:'address_key']

  self.line1 = attributes[:'line1'] if attributes[:'line1']

  self.line2 = attributes[:'line2'] if attributes[:'line2']

  self.city = attributes[:'city'] if attributes[:'city']

  self.country = attributes[:'country'] if attributes[:'country']

  self.postal_code = attributes[:'postalCode'] if attributes[:'postalCode']

  raise 'You cannot provide both :postalCode and :postal_code' if attributes.key?(:'postalCode') && attributes.key?(:'postal_code')

  self.postal_code = attributes[:'postal_code'] if attributes[:'postal_code']

  self.state = attributes[:'state'] if attributes[:'state']

  self.email_address = attributes[:'emailAddress'] if attributes[:'emailAddress']

  raise 'You cannot provide both :emailAddress and :email_address' if attributes.key?(:'emailAddress') && attributes.key?(:'email_address')

  self.email_address = attributes[:'email_address'] if attributes[:'email_address']

  self.company_name = attributes[:'companyName'] if attributes[:'companyName']

  raise 'You cannot provide both :companyName and :company_name' if attributes.key?(:'companyName') && attributes.key?(:'company_name')

  self.company_name = attributes[:'company_name'] if attributes[:'company_name']

  self.first_name = attributes[:'firstName'] if attributes[:'firstName']

  raise 'You cannot provide both :firstName and :first_name' if attributes.key?(:'firstName') && attributes.key?(:'first_name')

  self.first_name = attributes[:'first_name'] if attributes[:'first_name']

  self.last_name = attributes[:'lastName'] if attributes[:'lastName']

  raise 'You cannot provide both :lastName and :last_name' if attributes.key?(:'lastName') && attributes.key?(:'last_name')

  self.last_name = attributes[:'last_name'] if attributes[:'last_name']
end

Instance Attribute Details

#address_keyString

Address identifier.

Returns:

  • (String)


12
13
14
# File 'lib/oci/osp_gateway/models/billing_address.rb', line 12

def address_key
  @address_key
end

#cityString

Name of the city.

Returns:

  • (String)


24
25
26
# File 'lib/oci/osp_gateway/models/billing_address.rb', line 24

def city
  @city
end

#company_nameString

Name of the customer company.

Returns:

  • (String)


44
45
46
# File 'lib/oci/osp_gateway/models/billing_address.rb', line 44

def company_name
  @company_name
end

#countryString

Country of the address.

Returns:

  • (String)


28
29
30
# File 'lib/oci/osp_gateway/models/billing_address.rb', line 28

def country
  @country
end

#email_addressString

Contact person email address.

Returns:

  • (String)


40
41
42
# File 'lib/oci/osp_gateway/models/billing_address.rb', line 40

def email_address
  @email_address
end

#first_nameString

First name of the contact person.

Returns:

  • (String)


48
49
50
# File 'lib/oci/osp_gateway/models/billing_address.rb', line 48

def first_name
  @first_name
end

#last_nameString

Last name of the contact person.

Returns:

  • (String)


52
53
54
# File 'lib/oci/osp_gateway/models/billing_address.rb', line 52

def last_name
  @last_name
end

#line1String

Address line 1.

Returns:

  • (String)


16
17
18
# File 'lib/oci/osp_gateway/models/billing_address.rb', line 16

def line1
  @line1
end

#line2String

Address line 2.

Returns:

  • (String)


20
21
22
# File 'lib/oci/osp_gateway/models/billing_address.rb', line 20

def line2
  @line2
end

#postal_codeString

Post code of the address.

Returns:

  • (String)


32
33
34
# File 'lib/oci/osp_gateway/models/billing_address.rb', line 32

def postal_code
  @postal_code
end

#stateString

State of the address.

Returns:

  • (String)


36
37
38
# File 'lib/oci/osp_gateway/models/billing_address.rb', line 36

def state
  @state
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/oci/osp_gateway/models/billing_address.rb', line 55

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'address_key': :'addressKey',
    'line1': :'line1',
    'line2': :'line2',
    'city': :'city',
    'country': :'country',
    'postal_code': :'postalCode',
    'state': :'state',
    'email_address': :'emailAddress',
    'company_name': :'companyName',
    'first_name': :'firstName',
    'last_name': :'lastName'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/oci/osp_gateway/models/billing_address.rb', line 74

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'address_key': :'String',
    'line1': :'String',
    'line2': :'String',
    'city': :'String',
    'country': :'String',
    'postal_code': :'String',
    'state': :'String',
    'email_address': :'String',
    'company_name': :'String',
    'first_name': :'String',
    'last_name': :'String'
    # rubocop:enable Style/SymbolLiteral
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other (Object)

    the other object to be compared



169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# File 'lib/oci/osp_gateway/models/billing_address.rb', line 169

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    address_key == other.address_key &&
    line1 == other.line1 &&
    line2 == other.line2 &&
    city == other.city &&
    country == other.country &&
    postal_code == other.postal_code &&
    state == other.state &&
    email_address == other.email_address &&
    company_name == other.company_name &&
    first_name == other.first_name &&
    last_name == other.last_name
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
# File 'lib/oci/osp_gateway/models/billing_address.rb', line 209

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)

  self.class.swagger_types.each_pair do |key, type|
    if type =~ /^Array<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        public_method("#{key}=").call(
          attributes[self.class.attribute_map[key]]
            .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
        )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      public_method("#{key}=").call(
        OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
      )
    end
    # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • other (Object)

    the other object to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


189
190
191
# File 'lib/oci/osp_gateway/models/billing_address.rb', line 189

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



198
199
200
# File 'lib/oci/osp_gateway/models/billing_address.rb', line 198

def hash
  [address_key, line1, line2, city, country, postal_code, state, email_address, company_name, first_name, last_name].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



242
243
244
245
246
247
248
249
250
251
# File 'lib/oci/osp_gateway/models/billing_address.rb', line 242

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = public_method(attr).call
    next if value.nil? && !instance_variable_defined?("@#{attr}")

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



236
237
238
# File 'lib/oci/osp_gateway/models/billing_address.rb', line 236

def to_s
  to_hash.to_s
end