Class: PactBroker::Api::Resources::Version

Inherits:
BaseResource
  • Object
show all
Defined in:
lib/pact_broker/api/resources/version.rb

Instance Method Summary collapse

Instance Method Details

#allowed_methodsObject



14
15
16
# File 'lib/pact_broker/api/resources/version.rb', line 14

def allowed_methods
  ["GET", "DELETE", "OPTIONS"]
end

#content_types_providedObject



10
11
12
# File 'lib/pact_broker/api/resources/version.rb', line 10

def content_types_provided
  [["application/hal+json", :to_json]]
end

#delete_resourceObject



30
31
32
33
# File 'lib/pact_broker/api/resources/version.rb', line 30

def delete_resource
  version_service.delete version
  true
end

#resource_exists?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/pact_broker/api/resources/version.rb', line 18

def resource_exists?
  !!resource_object
end

#resource_objectObject



22
23
24
# File 'lib/pact_broker/api/resources/version.rb', line 22

def resource_object
  version
end

#to_jsonObject



26
27
28
# File 'lib/pact_broker/api/resources/version.rb', line 26

def to_json
  Decorators::VersionDecorator.new(version).to_json(user_options: {base_url: base_url})
end