Class: PactBroker::Pacts::AllPacts

Inherits:
Object
  • Object
show all
Defined in:
lib/pact_broker/pacts/all_pacts.rb

Direct Known Subclasses

LatestPacts, LatestTaggedPacts

Instance Method Summary collapse

Instance Method Details

#to_domainObject



63
64
65
66
67
# File 'lib/pact_broker/pacts/all_pacts.rb', line 63

def to_domain
  domain = to_domain_without_tags
  domain.consumer_version.tags = tags
  domain
end

#to_domain_with_contentObject



88
89
90
91
92
# File 'lib/pact_broker/pacts/all_pacts.rb', line 88

def to_domain_with_content
  to_domain.tap do | pact |
    pact.json_content = pact_version_content.content
  end
end

#to_domain_without_tagsObject



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/pact_broker/pacts/all_pacts.rb', line 69

def to_domain_without_tags
  consumer = Domain::Pacticipant.new(name: consumer_name)
  consumer.id = consumer_id
  provider = Domain::Pacticipant.new(name: provider_name)
  provider.id = provider_id
  consumer_version = OpenStruct.new(
    number: consumer_version_number,
    order: consumer_version_order,
    pacticipant: consumer,
    tags: nil)
  Domain::Pact.new(id: id,
    consumer: consumer,
    consumer_version: consumer_version,
    provider: provider,
    consumer_version_number: consumer_version_number,
    created_at: created_at,
    updated_at: updated_at)
end