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.



18451
18452
18453
18454
18455
18456
18457
18458
18459
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18451

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.



18449
18450
18451
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18449

def country
  @country
end

#idObject (readonly)

Returns the value of attribute id.



18449
18450
18451
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18449

def id
  @id
end

#languageObject (readonly)

Returns the value of attribute language.



18449
18450
18451
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18449

def language
  @language
end

#nameObject (readonly)

Returns the value of attribute name.



18449
18450
18451
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18449

def name
  @name
end

#numbersObject (readonly)

Returns the value of attribute numbers.



18449
18450
18451
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18449

def numbers
  @numbers
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



18465
18466
18467
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18465

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

#to_hashObject



18469
18470
18471
18472
18473
18474
18475
18476
18477
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18469

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

#to_jsonObject



18461
18462
18463
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18461

def to_json
  JSON.dump(to_hash)
end