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.



56293
56294
56295
56296
56297
56298
56299
56300
56301
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56293

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.



56291
56292
56293
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56291

def city
  @city
end

#countryObject (readonly)

Returns the value of attribute country.



56291
56292
56293
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56291

def country
  @country
end

#postalObject (readonly)

Returns the value of attribute postal.



56291
56292
56293
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56291

def postal
  @postal
end

#provinceObject (readonly)

Returns the value of attribute province.



56291
56292
56293
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56291

def province
  @province
end

#streetsObject (readonly)

Returns the value of attribute streets.



56291
56292
56293
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56291

def streets
  @streets
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



56307
56308
56309
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56307

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

#to_hashObject



56311
56312
56313
56314
56315
56316
56317
56318
56319
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56311

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

#to_jsonObject



56303
56304
56305
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56303

def to_json
  JSON.dump(to_hash)
end