Class: Doconomy::Api::Language

Inherits:
Base
  • Object
show all
Defined in:
lib/doconomy/api/language.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#attributes

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

client, #errors

Constructor Details

#initialize(attributes = {}) ⇒ Language

Returns a new instance of Language.



8
9
10
11
# File 'lib/doconomy/api/language.rb', line 8

def initialize(attributes = {})
  @attributes = attributes.deep_symbolize_keys
  @code = @attributes[:code]
end

Instance Attribute Details

#codeObject

Returns the value of attribute code.



6
7
8
# File 'lib/doconomy/api/language.rb', line 6

def code
  @code
end

Class Method Details

.allArray<Doconomy::Api::Language>

Returns all languages

Returns:



18
19
20
21
# File 'lib/doconomy/api/language.rb', line 18

def all
  response = client.get("/aland-index/#{Doconomy::Api.configuration.api_version}/languages")
  response[:languages].map { |attributes| new(attributes) }
end