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.



32536
32537
32538
32539
32540
32541
32542
32543
32544
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32536

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.



32534
32535
32536
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32534

def country
  @country
end

#currencyObject (readonly)

Returns the value of attribute currency.



32534
32535
32536
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32534

def currency
  @currency
end

#experienceObject (readonly)

Returns the value of attribute experience.



32534
32535
32536
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32534

def experience
  @experience
end

#languageObject (readonly)

Returns the value of attribute language.



32534
32535
32536
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32534

def language
  @language
end

#localeObject (readonly)

Returns the value of attribute locale.



32534
32535
32536
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32534

def locale
  @locale
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



32550
32551
32552
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32550

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

#to_hashObject



32554
32555
32556
32557
32558
32559
32560
32561
32562
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32554

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

#to_jsonObject



32546
32547
32548
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32546

def to_json
  JSON.dump(to_hash)
end