Class: Io::Flow::V0::Models::GeoForm

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

Overview

Form used to update geographic preferences

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ GeoForm

Returns a new instance of GeoForm.



44309
44310
44311
44312
44313
44314
44315
44316
44317
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44309

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:country, :currency, :language, :locale, :experience], 'GeoForm')
  @country = HttpClient::Preconditions.assert_class('country', opts.delete(:country), String)
  @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String)
  @language = HttpClient::Preconditions.assert_class('language', opts.delete(:language), String)
  @locale = HttpClient::Preconditions.assert_class('locale', opts.delete(:locale), String)
  @experience = HttpClient::Preconditions.assert_class('experience', opts.delete(:experience), String)
end

Instance Attribute Details

#countryObject (readonly)

Returns the value of attribute country.



44307
44308
44309
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44307

def country
  @country
end

#currencyObject (readonly)

Returns the value of attribute currency.



44307
44308
44309
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44307

def currency
  @currency
end

#experienceObject (readonly)

Returns the value of attribute experience.



44307
44308
44309
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44307

def experience
  @experience
end

#languageObject (readonly)

Returns the value of attribute language.



44307
44308
44309
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44307

def language
  @language
end

#localeObject (readonly)

Returns the value of attribute locale.



44307
44308
44309
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44307

def locale
  @locale
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



44323
44324
44325
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44323

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

#to_hashObject



44327
44328
44329
44330
44331
44332
44333
44334
44335
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44327

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

#to_jsonObject



44319
44320
44321
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44319

def to_json
  JSON.dump(to_hash)
end