class Clarinet::Concepts
Public Class Methods
new(app, raw_data = [])
click to toggle source
# File lib/clarinet/concepts.rb, line 9 def initialize(app, raw_data = []) @app = app @raw_data = raw_data @concepts = raw_data.map do |concept_data| Clarinet::Concept.new concept_data end end
Public Instance Methods
create(concepts)
click to toggle source
# File lib/clarinet/concepts.rb, line 18 def create(concepts) concepts = [concepts] unless concepts.is_a? Array concepts = concepts.map { |concept| format_concept(concept) } data = @app.client.concepts.create concepts Clarinet::Concepts.new @app, data[:concepts] end
get(id)
click to toggle source
# File lib/clarinet/concepts.rb, line 31 def get(id) data = @app.client.concept id Clarinet::Concept.new data[:concept] end
list(options = { page: 1, per_page: 20 })
click to toggle source
# File lib/clarinet/concepts.rb, line 26 def list(options = { page: 1, per_page: 20 }) data = @app.client.concepts options Clarinet::Concepts.new @app, data[:concepts] end
search(name, language = nil)
click to toggle source
# File lib/clarinet/concepts.rb, line 36 def search(name, language = nil) query = { name: name, language: language } data = @app.client.concepts_search query Clarinet::Concepts.new @app, data[:concepts] end