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

Inherits:
Object
  • Object
show all
Defined in:
lib/io_flow_reference_v0.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.



415
416
417
418
419
420
421
422
423
# File 'lib/io_flow_reference_v0.rb', line 415

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::Reference::V0::Models::LocaleNumbers) ? x : ::Io::Flow::Reference::V0::Models::LocaleNumbers.new(x))
end

Instance Attribute Details

#countryObject (readonly)

Returns the value of attribute country.



413
414
415
# File 'lib/io_flow_reference_v0.rb', line 413

def country
  @country
end

#idObject (readonly)

Returns the value of attribute id.



413
414
415
# File 'lib/io_flow_reference_v0.rb', line 413

def id
  @id
end

#languageObject (readonly)

Returns the value of attribute language.



413
414
415
# File 'lib/io_flow_reference_v0.rb', line 413

def language
  @language
end

#nameObject (readonly)

Returns the value of attribute name.



413
414
415
# File 'lib/io_flow_reference_v0.rb', line 413

def name
  @name
end

#numbersObject (readonly)

Returns the value of attribute numbers.



413
414
415
# File 'lib/io_flow_reference_v0.rb', line 413

def numbers
  @numbers
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



429
430
431
# File 'lib/io_flow_reference_v0.rb', line 429

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

#to_hashObject



433
434
435
436
437
438
439
440
441
# File 'lib/io_flow_reference_v0.rb', line 433

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

#to_jsonObject



425
426
427
# File 'lib/io_flow_reference_v0.rb', line 425

def to_json
  JSON.dump(to_hash)
end