Class: Io::Flow::V0::Models::PaymentAddress

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ PaymentAddress

Returns a new instance of PaymentAddress.



52058
52059
52060
52061
52062
52063
52064
52065
52066
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52058

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:streets, :city, :country], 'PaymentAddress')
  @streets = HttpClient::Preconditions.assert_class('streets', opts.delete(:streets), Array).map { |v| HttpClient::Preconditions.assert_class('streets', v, String) }
  @city = HttpClient::Preconditions.assert_class('city', opts.delete(:city), String)
  @province = (x = opts.delete(:province); x.nil? ? nil : HttpClient::Preconditions.assert_class('province', x, String))
  @postal = (x = opts.delete(:postal); x.nil? ? nil : HttpClient::Preconditions.assert_class('postal', x, String))
  @country = HttpClient::Preconditions.assert_class('country', opts.delete(:country), String)
end

Instance Attribute Details

#cityObject (readonly)

Returns the value of attribute city.



52056
52057
52058
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52056

def city
  @city
end

#countryObject (readonly)

Returns the value of attribute country.



52056
52057
52058
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52056

def country
  @country
end

#postalObject (readonly)

Returns the value of attribute postal.



52056
52057
52058
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52056

def postal
  @postal
end

#provinceObject (readonly)

Returns the value of attribute province.



52056
52057
52058
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52056

def province
  @province
end

#streetsObject (readonly)

Returns the value of attribute streets.



52056
52057
52058
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52056

def streets
  @streets
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



52072
52073
52074
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52072

def copy(incoming={})
  PaymentAddress.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#to_hashObject



52076
52077
52078
52079
52080
52081
52082
52083
52084
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52076

def to_hash
  {
    :streets => streets,
    :city => city,
    :province => province,
    :postal => postal,
    :country => country
  }
end

#to_jsonObject



52068
52069
52070
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52068

def to_json
  JSON.dump(to_hash)
end