Class: Syntaxdb::Concept

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(concept_id = nil, permalink = nil) ⇒ Concept



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

def initialize(concept_id = nil, permalink = nil)
  @concept_id = concept_id
  @concept_permalink = permalink
end

Instance Attribute Details

#concept_idObject

Returns the value of attribute concept_id.



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

def concept_id
  @concept_id
end

Returns the value of attribute concept_permalink.



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

def concept_permalink
  @concept_permalink
end

Class Method Details

.all(options = {}) ⇒ Object



17
18
19
# File 'lib/syntaxdb/concept.rb', line 17

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

.find(options = {}) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/syntaxdb/concept.rb', line 21

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

.find_category_concepts(options = {}) ⇒ Object



51
52
53
54
55
56
57
58
59
# File 'lib/syntaxdb/concept.rb', line 51

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

.language_concepts(options = {}) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/syntaxdb/concept.rb', line 29

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

.searchObject



14
15
# File 'lib/syntaxdb/concept.rb', line 14

def search
end

.search_concepts(options = {}) ⇒ Object



43
44
45
46
47
48
49
# File 'lib/syntaxdb/concept.rb', line 43

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