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.



40210
40211
40212
40213
40214
40215
40216
40217
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40210

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.



40208
40209
40210
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40208

def country
  @country
end

#currencyObject (readonly)

Returns the value of attribute currency.



40208
40209
40210
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40208

def currency
  @currency
end

#ipObject (readonly)

Returns the value of attribute ip.



40208
40209
40210
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40208

def ip
  @ip
end

#languageObject (readonly)

Returns the value of attribute language.



40208
40209
40210
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40208

def language
  @language
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



40223
40224
40225
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40223

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

#to_hashObject



40227
40228
40229
40230
40231
40232
40233
40234
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40227

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

#to_jsonObject



40219
40220
40221
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40219

def to_json
  JSON.dump(to_hash)
end