Class: Ingenia::Tag
Constant Summary collapse
- PATH =
'/tags'- TAG_KNOWN_PARAMS =
These are known request params, all other params will go inside the json object
i{ full_text offset limit tag_ids }
Constants included from Api
Class Method Summary collapse
-
.all(params = {}) ⇒ Object
Index your tags.
-
.create(params = {}) ⇒ Object
Create a new tag.
- .destroy(id) ⇒ Object
-
.get(id, params = {}) ⇒ Object
Get a single tag by id.
-
.merge(id, params = {}) ⇒ Object
Update an existing tag.
-
.update(id, params = {}) ⇒ Object
Update an existing tag.
Methods included from Api
#api_key, #api_key=, #classify, #debug=, #endpoint=, #similar_to, #status, #summarize, #train, #trained_tags, #verify_response, #version=
Class Method Details
.all(params = {}) ⇒ Object
Index your tags
48 49 50 51 52 53 54 |
# File 'lib/ingenia_api/tag.rb', line 48 def self.all params = {} initialize_params params Ingenia::Api.verify_response do Remote.get(PATH, @params) end end |
.create(params = {}) ⇒ Object
Create a new tag
19 20 21 22 23 24 25 |
# File 'lib/ingenia_api/tag.rb', line 19 def self.create params = {} initialize_params params Ingenia::Api.verify_response do Remote.post(PATH, @params) end end |
.destroy(id) ⇒ Object
56 57 58 59 60 |
# File 'lib/ingenia_api/tag.rb', line 56 def self.destroy id Ingenia::Api.verify_response do Remote.delete("#{PATH}/#{id}", :params => { :api_key => Ingenia::Api.api_key }) end end |
.get(id, params = {}) ⇒ Object
Get a single tag by id
10 11 12 13 14 15 16 |
# File 'lib/ingenia_api/tag.rb', line 10 def self.get id, params = {} initialize_params params Ingenia::Api.verify_response do Remote.get "#{PATH}/#{id}", @params end end |
.merge(id, params = {}) ⇒ Object
Update an existing tag
37 38 39 40 41 42 43 44 45 |
# File 'lib/ingenia_api/tag.rb', line 37 def self.merge id, params = {} # dirty hack params[:tag_ids] = params[:tag_ids].to_json initialize_params params Ingenia::Api.verify_response do Remote.post("#{PATH}/#{id}/merge", @params) end end |
.update(id, params = {}) ⇒ Object
Update an existing tag
28 29 30 31 32 33 34 |
# File 'lib/ingenia_api/tag.rb', line 28 def self.update id, params = {} initialize_params params Ingenia::Api.verify_response do Remote.put("#{PATH}/#{id}", @params) end end |