Class: Io::Flow::V0::Models::CountryDefaults

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

Overview

Provides country level default settings for currency, language, etc.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ CountryDefaults

Returns a new instance of CountryDefaults.



22131
22132
22133
22134
22135
22136
22137
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22131

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:country, :currency, :language], 'CountryDefaults')
  @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)
end

Instance Attribute Details

#countryObject (readonly)

Returns the value of attribute country.



22129
22130
22131
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22129

def country
  @country
end

#currencyObject (readonly)

Returns the value of attribute currency.



22129
22130
22131
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22129

def currency
  @currency
end

#languageObject (readonly)

Returns the value of attribute language.



22129
22130
22131
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22129

def language
  @language
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



22143
22144
22145
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22143

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

#to_hashObject



22147
22148
22149
22150
22151
22152
22153
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22147

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

#to_jsonObject



22139
22140
22141
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22139

def to_json
  JSON.dump(to_hash)
end