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.



23904
23905
23906
23907
23908
23909
23910
23911
23912
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23904

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.



23902
23903
23904
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23902

def country
  @country
end

#currencyObject (readonly)

Returns the value of attribute currency.



23902
23903
23904
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23902

def currency
  @currency
end

#experienceObject (readonly)

Returns the value of attribute experience.



23902
23903
23904
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23902

def experience
  @experience
end

#languageObject (readonly)

Returns the value of attribute language.



23902
23903
23904
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23902

def language
  @language
end

#localeObject (readonly)

Returns the value of attribute locale.



23902
23903
23904
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23902

def locale
  @locale
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



23918
23919
23920
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23918

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

#to_hashObject



23922
23923
23924
23925
23926
23927
23928
23929
23930
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23922

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

#to_jsonObject



23914
23915
23916
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23914

def to_json
  JSON.dump(to_hash)
end