Class: PactBroker::Api::Resources::Tag
- Inherits:
-
BaseResource
- Object
- BaseResource
- PactBroker::Api::Resources::Tag
- Defined in:
- lib/pact_broker/api/resources/tag.rb
Instance Method Summary collapse
- #allowed_methods ⇒ Object
- #content_types_accepted ⇒ Object
- #content_types_provided ⇒ Object
- #delete_resource ⇒ Object
- #from_json ⇒ Object
- #policy_name ⇒ Object
- #resource_exists? ⇒ Boolean
- #tag ⇒ Object
- #to_json ⇒ Object
Instance Method Details
#allowed_methods ⇒ Object
16 17 18 |
# File 'lib/pact_broker/api/resources/tag.rb', line 16 def allowed_methods ["GET","PUT","DELETE", "OPTIONS"] end |
#content_types_accepted ⇒ Object
12 13 14 |
# File 'lib/pact_broker/api/resources/tag.rb', line 12 def content_types_accepted [["application/json", :from_json]] end |
#content_types_provided ⇒ Object
8 9 10 |
# File 'lib/pact_broker/api/resources/tag.rb', line 8 def content_types_provided [["application/hal+json", :to_json]] end |
#delete_resource ⇒ Object
42 43 44 45 |
# File 'lib/pact_broker/api/resources/tag.rb', line 42 def delete_resource tag_service.delete identifier_from_path true end |
#from_json ⇒ Object
20 21 22 23 24 25 26 27 28 |
# 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 ⇒ Object
47 48 49 |
# File 'lib/pact_broker/api/resources/tag.rb', line 47 def policy_name :'tags::tag' end |
#resource_exists? ⇒ Boolean
30 31 32 |
# File 'lib/pact_broker/api/resources/tag.rb', line 30 def resource_exists? !!tag end |
#tag ⇒ Object
38 39 40 |
# File 'lib/pact_broker/api/resources/tag.rb', line 38 def tag @tag ||= tag_service.find identifier_from_path end |
#to_json ⇒ Object
34 35 36 |
# File 'lib/pact_broker/api/resources/tag.rb', line 34 def to_json decorator_class(:tag_decorator).new(tag).to_json() end |