Class: Syntaxdb::Language

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

Returns the value of attribute language_permalink.



5
6
7
# File 'lib/syntaxdb/language.rb', line 5

def language_permalink
  @language_permalink
end

Class Method Details

.all(options = {}) ⇒ Object



12
13
14
# File 'lib/syntaxdb/language.rb', line 12

def all(options = {})
  Syntaxdb::Request.send_request(options, '/languages')
end

.find(options = {}) ⇒ Object

params language_permalink



17
18
19
20
21
22
23
# File 'lib/syntaxdb/language.rb', line 17

def find(options = {})
  @language_permalink = options[:language_permalink]
  if @language_permalink
    options.delete(:language_permalink)
    Syntaxdb::Request.send_request(options, "/languages/#{@language_permalink}")
  end
end

.find_categories(options = {}) ⇒ Object

params language_permalink Find categories by language_permalink



27
28
29
30
31
32
33
# File 'lib/syntaxdb/language.rb', line 27

def find_categories(options = {})
  @language_permalink = options[:language_permalink]
  if @language_permalink
    options.delete(:language_permalink)
    Syntaxdb::Request.send_request(options, "/languages/#{@language_permalink}/categories")
  end
end

.find_concepts(options = {}) ⇒ Object

Find concepts by language_permalink and category



36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/syntaxdb/language.rb', line 36

def find_concepts(options = {})
  @language_permalink = options[:language_permalink]
  category_id = options[:category_id]
  if @language_permalink
    options.delete(:language_permalink)
    if category_id
      options.delete(:category_id)
      Syntaxdb::Request.send_request(options, "/languages/#{@language_permalink}/categories/#{category_id}/concepts")
    else
      Syntaxdb::Request.send_request(options, "/languages/#{@language_permalink}/concepts")
    end
  end
end

Instance Method Details

#initalize(language_permalink = nil) ⇒ Object



7
8
9
# File 'lib/syntaxdb/language.rb', line 7

def initalize(language_permalink = nil)
  @language_permalink = language_permalink
end