Class: Hatchbuck::Tag
- Inherits:
-
Object
- Object
- Hatchbuck::Tag
- Defined in:
- lib/objects/tag.rb
Class Method Summary collapse
Class Method Details
.create(term, tag) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/objects/tag.rb', line 4 def self.create(term, tag) endpoint = Hatchbuck::URLifier.build(@object_path, "/#{term}/tags") conn = Faraday.new result = conn.post do |req| req.url endpoint req.headers['Content-Type'] = 'application/json' req.body = '[{ "id": "' + tag + '" }]' end # handling response if result.status == 201 return result.body else return false puts "Error!" end end |