Class: TecDoc::Language

Inherits:
Object
  • Object
show all
Defined in:
lib/tec_doc/language.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#codeObject

Returns the value of attribute code.



3
4
5
# File 'lib/tec_doc/language.rb', line 3

def code
  @code
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/tec_doc/language.rb', line 3

def name
  @name
end

Class Method Details

.all(options = {}) ⇒ Array<TecDoc::Language>

Get all languages available for provider.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :lang (String)

    language code according to ISO 639

Returns:



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/tec_doc/language.rb', line 9

def self.all(options = {})
  options = {
    :lang => I18n.locale.to_s
  }.merge(options)
  response = TecDoc.client.request(:get_languages, options)
  response.map do |attributes|
    language = new
    language.code = attributes[:language_code].to_s
    language.name = attributes[:language_name].to_s
    language
  end
end