class PactBroker::Api::Resources::Tag

Public Instance Methods

allowed_methods() click to toggle source
# File lib/pact_broker/api/resources/tag.rb, line 16
def allowed_methods
  ["GET","PUT","DELETE", "OPTIONS"]
end
content_types_accepted() click to toggle source
# File lib/pact_broker/api/resources/tag.rb, line 12
def content_types_accepted
  [["application/json", :from_json]]
end
content_types_provided() click to toggle source
# File lib/pact_broker/api/resources/tag.rb, line 8
def content_types_provided
  [["application/hal+json", :to_json]]
end
delete_resource() click to toggle source
# File lib/pact_broker/api/resources/tag.rb, line 42
def delete_resource
  tag_service.delete identifier_from_path
  true
end
from_json() click to toggle source
# File lib/pact_broker/api/resources/tag.rb, line 20
def from_json
  unless tag
    @tag = tag_service.create identifier_from_path
    # Make it return a 201 by setting the Location header
    response.headers["Location"] = tag_url(base_url, tag)
  end
  deployed_version_service.maybe_create_deployed_version_for_tag(tag.version, identifier_from_path[:tag_name])
  response.body = to_json
end
policy_name() click to toggle source
# File lib/pact_broker/api/resources/tag.rb, line 47
def policy_name
  :'tags::tag'
end
resource_exists?() click to toggle source
# File lib/pact_broker/api/resources/tag.rb, line 30
def resource_exists?
  !!tag
end
tag() click to toggle source
# File lib/pact_broker/api/resources/tag.rb, line 38
def tag
  @tag ||= tag_service.find identifier_from_path
end
to_json() click to toggle source
# File lib/pact_broker/api/resources/tag.rb, line 34
def to_json
  decorator_class(:tag_decorator).new(tag).to_json(decorator_options)
end