Module: Siilar::Client::Tags
- Included in:
- TagsService
- Defined in:
- lib/siilar/client/tags.rb
Instance Method Summary collapse
-
#create_tag(attributes = {}) ⇒ Object
Create a tag.
-
#create_tag_collection(attributes = {}) ⇒ Object
Create a tag collection.
-
#delete_tag(tag) ⇒ Object
Delete a tag.
-
#delete_tag_collection(collection) ⇒ Object
Delete a tag collection.
-
#edit_tag(tag, attributes = {}) ⇒ Object
Edit a tag.
-
#edit_tag_collection(collection, attributes = {}) ⇒ Object
Edit a tag collection.
-
#find_tags(query = {}) ⇒ Object
list or find tags.
-
#tag(tag) ⇒ Object
Get one tag.
-
#tag_collection(collection) ⇒ Object
Get one tag collection.
-
#tag_collections(query = {}) ⇒ Object
list or find tag collections.
Instance Method Details
#create_tag(attributes = {}) ⇒ Object
Create a tag
72 73 74 75 76 77 |
# File 'lib/siilar/client/tags.rb', line 72 def create_tag(attributes = {}) Extra.validate_mandatory_attributes(attributes, [:title, :tag_collection]) response = client.post('2.0/tags', attributes) Struct::Tag.new(response) end |
#create_tag_collection(attributes = {}) ⇒ Object
Create a tag collection
27 28 29 30 31 32 |
# File 'lib/siilar/client/tags.rb', line 27 def create_tag_collection(attributes = {}) Extra.validate_mandatory_attributes(attributes, [:name]) response = client.post('2.0/tag-collections', attributes) Struct::TagCollection.new(response) end |
#delete_tag(tag) ⇒ Object
Delete a tag
91 92 93 |
# File 'lib/siilar/client/tags.rb', line 91 def delete_tag(tag) client.delete("2.0/tags/#{tag}") end |
#delete_tag_collection(collection) ⇒ Object
Delete a tag collection
46 47 48 |
# File 'lib/siilar/client/tags.rb', line 46 def delete_tag_collection(collection) client.delete("2.0/tag-collections/#{collection}") end |
#edit_tag(tag, attributes = {}) ⇒ Object
Edit a tag
82 83 84 85 86 |
# File 'lib/siilar/client/tags.rb', line 82 def edit_tag(tag, attributes = {}) response = client.patch("2.0/tags/#{tag}", attributes) Struct::Tag.new(response) end |
#edit_tag_collection(collection, attributes = {}) ⇒ Object
Edit a tag collection
37 38 39 40 41 |
# File 'lib/siilar/client/tags.rb', line 37 def edit_tag_collection(collection, attributes = {}) response = client.patch("2.0/tag-collections/#{collection}", attributes) Struct::TagCollection.new(response) end |
#find_tags(query = {}) ⇒ Object
list or find tags
53 54 55 56 57 58 |
# File 'lib/siilar/client/tags.rb', line 53 def (query = {}) = { query: query } response = client.get('2.0/tags', ) response['data'].map { |tag| Struct::Tag.new(tag) } end |
#tag(tag) ⇒ Object
Get one tag
63 64 65 66 67 |
# File 'lib/siilar/client/tags.rb', line 63 def tag(tag) response = client.get("2.0/tags/#{tag}") Struct::Tag.new(response) end |
#tag_collection(collection) ⇒ Object
Get one tag collection
18 19 20 21 22 |
# File 'lib/siilar/client/tags.rb', line 18 def tag_collection(collection) response = client.get("2.0/tag-collections/#{collection}") Struct::TagCollection.new(response) end |
#tag_collections(query = {}) ⇒ Object
list or find tag collections
8 9 10 11 12 13 |
# File 'lib/siilar/client/tags.rb', line 8 def tag_collections(query = {}) = { query: query } response = client.get('2.0/tag-collections', ) response['data'].map { |r| Struct::TagCollection.new(r) } end |