class PaymentsApi::Address

Address Information

Attributes

address1[RW]

Address Line 1 @return [String]

address2[RW]

Address Line 2 @return [String]

city[RW]

City @return [String]

country[RW]

Country (ISO 3166-1 Alpha-2 Code) @return [String]

postal_code[RW]

Postal Code @return [String]

state[RW]

State / Province @return [String]

Public Class Methods

from_hash(hash) click to toggle source

Creates an instance of the object from a hash.

# File lib/payments_api/models/address.rb, line 60
def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  address1 = hash['address1']
  city = hash['city']
  postal_code = hash['postalCode']
  country = hash['country']
  address2 = hash['address2']
  state = hash['state']

  # Create object from extracted values.
  Address.new(address1,
              city,
              postal_code,
              country,
              address2,
              state)
end
names() click to toggle source

A mapping from model property names to API property names.

# File lib/payments_api/models/address.rb, line 34
def self.names
  @_hash = {} if @_hash.nil?
  @_hash['address1'] = 'address1'
  @_hash['address2'] = 'address2'
  @_hash['city'] = 'city'
  @_hash['state'] = 'state'
  @_hash['postal_code'] = 'postalCode'
  @_hash['country'] = 'country'
  @_hash
end
new(address1 = nil, city = nil, postal_code = nil, country = nil, address2 = nil, state = nil) click to toggle source
# File lib/payments_api/models/address.rb, line 45
def initialize(address1 = nil,
               city = nil,
               postal_code = nil,
               country = nil,
               address2 = nil,
               state = nil)
  @address1 = address1
  @address2 = address2
  @city = city
  @state = state
  @postal_code = postal_code
  @country = country
end