Class: PactBroker::Api::Resources::Versions

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

Instance Method Summary collapse

Instance Method Details

#allowed_methodsObject



13
14
15
# File 'lib/pact_broker/api/resources/versions.rb', line 13

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

#content_types_providedObject



9
10
11
# File 'lib/pact_broker/api/resources/versions.rb', line 9

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

#policy_nameObject



29
30
31
# File 'lib/pact_broker/api/resources/versions.rb', line 29

def policy_name
  :'versions::versions'
end

#resource_exists?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/pact_broker/api/resources/versions.rb', line 17

def resource_exists?
  !!pacticipant
end

#to_jsonObject



21
22
23
# File 'lib/pact_broker/api/resources/versions.rb', line 21

def to_json
  PactBroker::Api::Decorators::VersionsDecorator.new(versions).to_json(user_options: decorator_context(identifier_from_path))
end

#versionsObject



25
26
27
# File 'lib/pact_broker/api/resources/versions.rb', line 25

def versions
  @versions ||= pacticipant_service.find_all_pacticipant_versions_in_reverse_order pacticipant_name
end