Class: Io::Flow::V0::Models::LocalizedTranslation

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Overview

Localized translation of a given province/region/country

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ LocalizedTranslation

Returns a new instance of LocalizedTranslation.



39208
39209
39210
39211
39212
39213
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39208

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:locale, :name], 'LocalizedTranslation')
  @locale = (x = opts.delete(:locale); x.is_a?(::Io::Flow::V0::Models::Locale) ? x : ::Io::Flow::V0::Models::Locale.new(x))
  @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
end

Instance Attribute Details

#localeObject (readonly)

Returns the value of attribute locale.



39206
39207
39208
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39206

def locale
  @locale
end

#nameObject (readonly)

Returns the value of attribute name.



39206
39207
39208
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39206

def name
  @name
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



39219
39220
39221
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39219

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

#to_hashObject



39223
39224
39225
39226
39227
39228
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39223

def to_hash
  {
    :locale => locale.to_hash,
    :name => name
  }
end

#to_jsonObject



39215
39216
39217
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39215

def to_json
  JSON.dump(to_hash)
end