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.



37059
37060
37061
37062
37063
37064
37065
37066
37067
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37059

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.



37057
37058
37059
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37057

def country
  @country
end

#idObject (readonly)

Returns the value of attribute id.



37057
37058
37059
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37057

def id
  @id
end

#languageObject (readonly)

Returns the value of attribute language.



37057
37058
37059
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37057

def language
  @language
end

#nameObject (readonly)

Returns the value of attribute name.



37057
37058
37059
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37057

def name
  @name
end

#numbersObject (readonly)

Returns the value of attribute numbers.



37057
37058
37059
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37057

def numbers
  @numbers
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



37073
37074
37075
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37073

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

#to_hashObject



37077
37078
37079
37080
37081
37082
37083
37084
37085
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37077

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

#to_jsonObject



37069
37070
37071
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37069

def to_json
  JSON.dump(to_hash)
end