Class: Io::Flow::V0::Models::Locale

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

Overview

Locales defines standard conventions for presentation of content. See api.flow.io/reference/locales

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ Locale

Returns a new instance of Locale.



20138
20139
20140
20141
20142
20143
20144
20145
20146
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20138

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :name, :country, :language, :numbers], 'Locale')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
  @country = HttpClient::Preconditions.assert_class('country', opts.delete(:country), String)
  @language = HttpClient::Preconditions.assert_class('language', opts.delete(:language), String)
  @numbers = (x = opts.delete(:numbers); x.is_a?(::Io::Flow::V0::Models::LocaleNumbers) ? x : ::Io::Flow::V0::Models::LocaleNumbers.new(x))
end

Instance Attribute Details

#countryObject (readonly)

Returns the value of attribute country.



20136
20137
20138
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20136

def country
  @country
end

#idObject (readonly)

Returns the value of attribute id.



20136
20137
20138
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20136

def id
  @id
end

#languageObject (readonly)

Returns the value of attribute language.



20136
20137
20138
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20136

def language
  @language
end

#nameObject (readonly)

Returns the value of attribute name.



20136
20137
20138
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20136

def name
  @name
end

#numbersObject (readonly)

Returns the value of attribute numbers.



20136
20137
20138
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20136

def numbers
  @numbers
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



20152
20153
20154
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20152

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

#to_hashObject



20156
20157
20158
20159
20160
20161
20162
20163
20164
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20156

def to_hash
  {
    :id => id,
    :name => name,
    :country => country,
    :language => language,
    :numbers => numbers.to_hash
  }
end

#to_jsonObject



20148
20149
20150
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20148

def to_json
  JSON.dump(to_hash)
end