Class: PactBroker::Api::Resources::PreviousDistinctPactVersion

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

Instance Method Summary collapse

Instance Method Details

#allowed_methodsObject



15
16
17
# File 'lib/pact_broker/api/resources/previous_distinct_pact_version.rb', line 15

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

#content_types_providedObject



11
12
13
# File 'lib/pact_broker/api/resources/previous_distinct_pact_version.rb', line 11

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

#pactObject



35
36
37
# File 'lib/pact_broker/api/resources/previous_distinct_pact_version.rb', line 35

def pact
  @pact ||= pact_service.find_previous_distinct_pact_version(pact_params)
end

#pact_paramsObject



39
40
41
# File 'lib/pact_broker/api/resources/previous_distinct_pact_version.rb', line 39

def pact_params
  @pact_params ||= PactBroker::Pacts::PactParams.from_request request, path_info
end

#policy_resourceObject



27
28
29
# File 'lib/pact_broker/api/resources/previous_distinct_pact_version.rb', line 27

def policy_resource
  pact
end

#resource_exists?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/pact_broker/api/resources/previous_distinct_pact_version.rb', line 19

def resource_exists?
  !!resource_object
end

#resource_objectObject



23
24
25
# File 'lib/pact_broker/api/resources/previous_distinct_pact_version.rb', line 23

def resource_object
  pact
end

#to_jsonObject



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

def to_json
  PactBroker::Api::Decorators::PactDecorator.new(pact).to_json(user_options: {base_url: base_url})
end