Module: Collins::Api::Tag
Constant Summary
Constants included from Util::Logging
Util::Logging::DEFAULT_LOG_FORMAT
Instance Method Summary collapse
-
#get_all_tags ⇒ Array<OpenStruct>
Get all collins tags.
-
#get_tag_values(tag, strict = false) ⇒ Array<String>
Get all values associated with the specified tag.
Methods included from Util
#deep_copy_hash, #get_asset_or_tag, included, #require_non_empty, #require_that, #stringify_hash, #symbolize_hash
Methods included from Util::Logging
Instance Method Details
#get_all_tags ⇒ Array<OpenStruct>
Get all collins tags
Sample output
20 21 22 23 24 25 26 |
# File 'lib/collins/api/tag.rb', line 20 def http_get("/api/tags") do |response| parse_response response, :expects => 200, :default => [], :raise => strict? do |json| json["data"]["tags"].map{|t| OpenStruct.new(symbolize_hash(t))} end end end |
#get_tag_values(tag, strict = false) ⇒ Array<String>
Note:
You will get a 404 if the tag does not exist. Depending on strict mode, this will result in an empty array or an exception
Get all values associated with the specified tag
35 36 37 38 39 40 41 |
# File 'lib/collins/api/tag.rb', line 35 def get_tag_values tag, strict = false http_get("/api/tag/#{tag}") do |response| parse_response response, :expects => 200, :default => [], :raise => strict?(strict) do |json| json["data"]["values"] end end end |