Class: Io::Flow::V0::Models::OrderGeo

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

Overview

The geolocated information for an order

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ OrderGeo

Returns a new instance of OrderGeo.



38996
38997
38998
38999
39000
39001
39002
39003
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38996

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:country], 'OrderGeo')
  @ip = (x = opts.delete(:ip); x.nil? ? nil : HttpClient::Preconditions.assert_class('ip', x, String))
  @country = HttpClient::Preconditions.assert_class('country', opts.delete(:country), String)
  @currency = (x = opts.delete(:currency); x.nil? ? nil : HttpClient::Preconditions.assert_class('currency', x, String))
  @language = (x = opts.delete(:language); x.nil? ? nil : HttpClient::Preconditions.assert_class('language', x, String))
end

Instance Attribute Details

#countryObject (readonly)

Returns the value of attribute country.



38994
38995
38996
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38994

def country
  @country
end

#currencyObject (readonly)

Returns the value of attribute currency.



38994
38995
38996
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38994

def currency
  @currency
end

#ipObject (readonly)

Returns the value of attribute ip.



38994
38995
38996
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38994

def ip
  @ip
end

#languageObject (readonly)

Returns the value of attribute language.



38994
38995
38996
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 38994

def language
  @language
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



39009
39010
39011
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39009

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

#to_hashObject



39013
39014
39015
39016
39017
39018
39019
39020
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39013

def to_hash
  {
    :ip => ip,
    :country => country,
    :currency => currency,
    :language => language
  }
end

#to_jsonObject



39005
39006
39007
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39005

def to_json
  JSON.dump(to_hash)
end