class SafetyRazor::Slice::TagMatcher
Client
API for Razor’s tag matcher slice.
@author Fletcher Nichol <fnichol@nichol.ca>
Public Instance Methods
all()
click to toggle source
# File lib/safety_razor/slice/tag_matcher.rb, line 25 def all raise NoMethodError, "TagMatcher#all is not defined" end
create(tag_uuid, params)
click to toggle source
# File lib/safety_razor/slice/tag_matcher.rb, line 14 def create(tag_uuid, params) payload = JSON.generate(params) response = connection.post(slice_path(tag_uuid), 'json_hash' => payload) parse(response).first end
destroy(tag_uuid, uuid)
click to toggle source
# File lib/safety_razor/slice/tag_matcher.rb, line 37 def destroy(tag_uuid, uuid) connection.delete(slice_path(tag_uuid, uuid)) end
get(tag_uuid, uuid)
click to toggle source
# File lib/safety_razor/slice/tag_matcher.rb, line 20 def get(tag_uuid, uuid) response = connection.get(slice_path(tag_uuid, uuid)) parse(response).first end
update(tag_uuid, params)
click to toggle source
# File lib/safety_razor/slice/tag_matcher.rb, line 29 def update(tag_uuid, params) payload = JSON.generate(params) uuid = params[:uuid] response = connection.put(slice_path(tag_uuid, uuid), 'json_hash' => payload) parse(response).first end
Protected Instance Methods
new_mash(obj)
click to toggle source
# File lib/safety_razor/slice/tag_matcher.rb, line 49 def new_mash(obj) Hashie::Mash.new(obj).extend(KeyReaderMethod) end
slice_path(tag_uuid, uuid = nil)
click to toggle source
# File lib/safety_razor/slice/tag_matcher.rb, line 43 def slice_path(tag_uuid, uuid = nil) path = "/razor/api/tag/#{tag_uuid}/matcher" path += "/#{uuid}" if uuid path end