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.



28811
28812
28813
28814
28815
28816
28817
28818
28819
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28811

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.



28809
28810
28811
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28809

def country
  @country
end

#idObject (readonly)

Returns the value of attribute id.



28809
28810
28811
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28809

def id
  @id
end

#languageObject (readonly)

Returns the value of attribute language.



28809
28810
28811
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28809

def language
  @language
end

#nameObject (readonly)

Returns the value of attribute name.



28809
28810
28811
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28809

def name
  @name
end

#numbersObject (readonly)

Returns the value of attribute numbers.



28809
28810
28811
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28809

def numbers
  @numbers
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



28825
28826
28827
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28825

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

#to_hashObject



28829
28830
28831
28832
28833
28834
28835
28836
28837
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28829

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

#to_jsonObject



28821
28822
28823
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28821

def to_json
  JSON.dump(to_hash)
end