class Io::Flow::V0::Models::Address

Defines structured fields for address to be used in user/form input. Either text or the structured input needs to be present.

Attributes

city[R]
country[R]
latitude[R]
longitude[R]
postal[R]
province[R]
street_number[R]
streets[R]
text[R]

Public Class Methods

new(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 29496
def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  @text = (x = opts.delete(:text); x.nil? ? nil : HttpClient::Preconditions.assert_class('text', x, String))
  @streets = (x = opts.delete(:streets); x.nil? ? nil : HttpClient::Preconditions.assert_class('streets', x, Array).map { |v| HttpClient::Preconditions.assert_class('streets', v, String) })
  @street_number = (x = opts.delete(:street_number); x.nil? ? nil : HttpClient::Preconditions.assert_class('street_number', x, String))
  @city = (x = opts.delete(:city); x.nil? ? nil : HttpClient::Preconditions.assert_class('city', x, 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 = (x = opts.delete(:country); x.nil? ? nil : HttpClient::Preconditions.assert_class('country', x, String))
  @latitude = (x = opts.delete(:latitude); x.nil? ? nil : HttpClient::Preconditions.assert_class('latitude', x, String))
  @longitude = (x = opts.delete(:longitude); x.nil? ? nil : HttpClient::Preconditions.assert_class('longitude', x, String))
end

Public Instance Methods

copy(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 29513
def copy(incoming={})
  Address.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end
to_hash() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 29517
def to_hash
  {
    :text => text,
    :streets => streets.nil? ? nil : streets,
    :street_number => street_number,
    :city => city,
    :province => province,
    :postal => postal,
    :country => country,
    :latitude => latitude,
    :longitude => longitude
  }
end
to_json() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 29509
def to_json
  JSON.dump(to_hash)
end