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 https://api.flow.io/reference/locales

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ Locale

Returns a new instance of Locale.



15632
15633
15634
15635
15636
15637
15638
15639
15640
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15632

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

#country ⇒ Object (readonly)

Returns the value of attribute country.



15630
15631
15632
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15630

def country
  @country
end

#id ⇒ Object (readonly)

Returns the value of attribute id.



15630
15631
15632
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15630

def id
  @id
end

#language ⇒ Object (readonly)

Returns the value of attribute language.



15630
15631
15632
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15630

def language
  @language
end

#name ⇒ Object (readonly)

Returns the value of attribute name.



15630
15631
15632
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15630

def name
  @name
end

#numbers ⇒ Object (readonly)

Returns the value of attribute numbers.



15630
15631
15632
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15630

def numbers
  @numbers
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



15646
15647
15648
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15646

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

#to_hash ⇒ Object



15650
15651
15652
15653
15654
15655
15656
15657
15658
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15650

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

#to_json ⇒ Object



15642
15643
15644
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15642

def to_json
  JSON.dump(to_hash)
end