pact_broker 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. data/CHANGELOG.md +15 -0
  2. data/Gemfile.lock +1 -1
  3. data/lib/pact_broker/api/decorators.rb +6 -0
  4. data/lib/pact_broker/api/decorators/base_decorator.rb +33 -0
  5. data/lib/pact_broker/api/{representors → decorators}/pact_broker_urls.rb +17 -5
  6. data/lib/pact_broker/api/decorators/pact_collection_decorator.rb +38 -0
  7. data/lib/pact_broker/api/decorators/pact_decorator.rb +22 -0
  8. data/lib/pact_broker/api/decorators/pact_pacticipant_decorator.rb +25 -0
  9. data/lib/pact_broker/api/{representors/pacticipant_collection_representor.rb → decorators/pacticipant_collection_decorator.rb} +6 -9
  10. data/lib/pact_broker/api/decorators/pacticipant_decorator.rb +32 -0
  11. data/lib/pact_broker/api/{representors → decorators}/representable_pact.rb +1 -1
  12. data/lib/pact_broker/api/decorators/version_decorator.rb +16 -0
  13. data/lib/pact_broker/repositories/pact_repository.rb +1 -0
  14. data/lib/pact_broker/resources/{json_resource.rb → base_resource.rb} +12 -14
  15. data/lib/pact_broker/resources/latest_pact.rb +2 -13
  16. data/lib/pact_broker/resources/latest_pacts.rb +3 -24
  17. data/lib/pact_broker/resources/pact.rb +9 -8
  18. data/lib/pact_broker/resources/pacticipant.rb +15 -27
  19. data/lib/pact_broker/resources/pacticipants.rb +3 -16
  20. data/lib/pact_broker/version.rb +1 -1
  21. data/spec/lib/pact_broker/api/{representors/pact_collection_representor_spec.rb → decorators/pact_collection_decorator_spec.rb} +3 -3
  22. data/spec/lib/pact_broker/api/{representors → decorators}/representable_pact_spec.rb +2 -2
  23. metadata +19 -19
  24. data/lib/pact_broker/api/representors.rb +0 -6
  25. data/lib/pact_broker/api/representors/pact_collection_representor.rb +0 -34
  26. data/lib/pact_broker/api/representors/pact_pacticipant_representor.rb +0 -27
  27. data/lib/pact_broker/api/representors/pact_representor.rb +0 -27
  28. data/lib/pact_broker/api/representors/pacticipant_empty_collection_representor.rb +0 -33
  29. data/lib/pact_broker/api/representors/pacticipant_representor.rb +0 -35
  30. data/lib/pact_broker/api/representors/version_representor.rb +0 -20
data/CHANGELOG.md CHANGED
@@ -2,6 +2,21 @@ Do this to generate your change history
2
2
 
3
3
  $ git log --date=relative --pretty=format:' * %h - %s (%an, %ad)' 'package/pact-broker-0.0.PRODVERSION'..'package/pact-broker-0.0.NEWVERSION'
4
4
 
5
+ #### 0.0.6 (2013-11-15)
6
+
7
+ * 021faae - Refactoring resources to DRY out code (Beth, 18 hours ago)
8
+ * bab0367 - Cleaning up the base_url setting hack. (Beth, 19 hours ago)
9
+ * f6df613 - Renamed representors to decorators (Beth, 19 hours ago)
10
+ * 3e89c20 - Created BaseDecorator (Beth, 19 hours ago)
11
+ * e5c3f88 - Changing from representors to decorators (Beth, 19 hours ago)
12
+ * b2eeb6f - Added back resource_exists? implementation in pacticipant resource - accidental deletion. (Beth, 19 hours ago)
13
+ * 1962a05 - Ever so slightly less hacky way of handling PATCH (Beth, 21 hours ago)
14
+ * 587e9c1 - First go at trying to use a dynamic base URL - to be continued (Beth, 2 days ago)
15
+ * ab9c185 - Including URLs for the dynamically calculated latest pact, not the hard link to the latest pact. (Beth, 2 days ago)
16
+ * 5621e41 - Beginning change from Roar Representor to Decoractor. Updating to new 'latest pact' URL (Beth, 2 days ago)
17
+ * d1bd995 - Adding missing PactBroker::Logging require (Beth, 2 days ago)
18
+
19
+
5
20
  #### 0.0.5 (2013-11-13)
6
21
 
7
22
  * 2cf987c - Added data migration to script which adds order column (Beth, 56 minutes ago)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pact_broker (0.0.5)
4
+ pact_broker (0.0.6)
5
5
  httparty
6
6
  json
7
7
  roar
@@ -0,0 +1,6 @@
1
+ require 'pact_broker/api/decorators/pacticipant_decorator'
2
+ require 'pact_broker/api/decorators/pacticipant_collection_decorator'
3
+ require 'pact_broker/api/decorators/version_decorator'
4
+ require 'pact_broker/api/decorators/pact_collection_decorator'
5
+ require 'pact_broker/api/decorators/pact_pacticipant_decorator'
6
+ require 'pact_broker/api/decorators/pact_decorator'
@@ -0,0 +1,33 @@
1
+ require 'roar/decorator'
2
+ require 'roar/representer/json/hal'
3
+ require 'pact_broker/api/decorators/pact_broker_urls'
4
+
5
+ module PactBroker
6
+
7
+ module Api
8
+
9
+ module Decorators
10
+
11
+ class BaseDecorator < Roar::Decorator
12
+ include Roar::Representer::JSON::HAL
13
+ include Roar::Representer::JSON::HAL::Links
14
+ include PactBroker::Api::PactBrokerUrls
15
+
16
+ def initialize represented, base_url = nil
17
+ super(represented)
18
+ @base_url = base_url
19
+ end
20
+
21
+ def to_json
22
+ json = super()
23
+ if @base_url
24
+ json.gsub(base_url_placeholder, @base_url)
25
+ else
26
+ json
27
+ end
28
+ end
29
+
30
+ end
31
+ end
32
+ end
33
+ end
@@ -2,12 +2,14 @@ module PactBroker
2
2
  module Api
3
3
  module PactBrokerUrls
4
4
 
5
- def base_url
6
- "http://localhost:1234"
5
+ BASE_URL_PLACEHOLDER = "http://_______PACT_BROKER_BASE_URL_PLACEHOLDER_TO_BE_REPLACED_AFTER_TO_JSON_______"
6
+
7
+ def base_url_placeholder
8
+ BASE_URL_PLACEHOLDER
7
9
  end
8
10
 
9
11
  def pacticipants_url
10
- "#{base_url}/pacticipants"
12
+ "#{base_url_placeholder}/pacticipants"
11
13
  end
12
14
 
13
15
  def pacticipant_url pacticipant
@@ -27,11 +29,21 @@ module PactBroker
27
29
  end
28
30
 
29
31
  def pact_url pact
30
- "#{version_url(pact.consumer_version)}/pacts/#{url_encode(pact.provider.name)}"
32
+ "#{pactigration_base_url(pact)}/version/#{pact.consumer.version.number}"
33
+ end
34
+
35
+ def latest_pact_url pact
36
+ "#{pactigration_base_url(pact)}/latest"
31
37
  end
32
38
 
33
39
  def latest_pacts_url
34
- "#{base_url}/pacts/latest"
40
+ "#{base_url_placeholder}/pacts/latest"
41
+ end
42
+
43
+ private
44
+
45
+ def pactigration_base_url pact
46
+ "#{base_url_placeholder}/pact/provider/#{url_encode(pact.provider.name)}/consumer/#{url_encode(pact.consumer.name)}"
35
47
  end
36
48
 
37
49
  def url_encode param
@@ -0,0 +1,38 @@
1
+ require_relative 'base_decorator'
2
+ require_relative 'version_decorator'
3
+ require_relative 'pact_decorator'
4
+ require_relative 'representable_pact'
5
+
6
+ module PactBroker
7
+
8
+ module Api
9
+
10
+ module Decorators
11
+
12
+ class PactCollectionRepresenter < BaseDecorator
13
+ include Roar::Representer::JSON::HAL
14
+ include PactBroker::Api::PactBrokerUrls
15
+
16
+ collection :pacts, decorator_scope: true, :class => PactBroker::Models::Pact, :extend => PactBroker::Api::Decorators::PactRepresenter
17
+
18
+ def pacts
19
+ represented.collect{ | pact | create_representable_pact(pact) }
20
+ end
21
+
22
+ def create_representable_pact pact
23
+ PactBroker::Api::Decorators::RepresentablePact.new(pact)
24
+ end
25
+
26
+ link :self do
27
+ latest_pacts_url
28
+ end
29
+
30
+ # This is the LATEST pact URL
31
+ links :pacts do
32
+ represented.collect{ | pact | {:href => latest_pact_url(pact), :consumer => pact.consumer.name, :provider => pact.provider.name } }
33
+ end
34
+
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,22 @@
1
+ require_relative 'base_decorator'
2
+ require_relative 'pact_pacticipant_decorator'
3
+
4
+ module PactBroker
5
+
6
+ module Api
7
+
8
+ module Decorators
9
+
10
+ class PactRepresenter < BaseDecorator
11
+
12
+ property :consumer, :extend => PactBroker::Api::Decorators::PactPacticipantRepresenter, :embedded => true
13
+ property :provider, :extend => PactBroker::Api::Decorators::PactPacticipantRepresenter, :embedded => true
14
+
15
+ link :self do
16
+ pact_url(represented)
17
+ end
18
+
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,25 @@
1
+ require_relative 'pact_broker_urls'
2
+ require_relative 'version_decorator'
3
+ require_relative 'base_decorator'
4
+
5
+
6
+ module PactBroker
7
+
8
+ module Api
9
+
10
+ module Decorators
11
+
12
+ class PactPacticipantRepresenter < BaseDecorator
13
+
14
+ property :name
15
+ property :repository_url
16
+ property :version, :class => "PactBroker::Models::Version", :extend => PactBroker::Api::Decorators::VersionRepresenter, :embedded => true
17
+
18
+ link :self do
19
+ pacticipant_url(represented)
20
+ end
21
+
22
+ end
23
+ end
24
+ end
25
+ end
@@ -1,6 +1,6 @@
1
1
  require 'roar/representer/json/hal'
2
2
  require_relative 'pact_broker_urls'
3
- require_relative 'version_representor'
3
+ require_relative 'version_decorator'
4
4
 
5
5
  module Roar
6
6
  module Representer
@@ -26,17 +26,14 @@ module PactBroker
26
26
 
27
27
  module Api
28
28
 
29
- module Representors
29
+ module Decorators
30
30
 
31
- module PacticipantCollectionRepresenter
32
- include Roar::Representer::JSON::HAL
33
- include PactBroker::Api::PactBrokerUrls
31
+ class PacticipantCollectionRepresenter < BaseDecorator
34
32
 
35
-
36
- collection :pacticipants, :class => PactBroker::Models::Pacticipant, :extend => PactBroker::Api::Representors::PacticipantRepresenter
33
+ collection :pacticipants, decorator_scope: true, :class => PactBroker::Models::Pacticipant, :extend => PactBroker::Api::Decorators::PacticipantRepresenter
37
34
 
38
35
  def pacticipants
39
- self
36
+ represented
40
37
  end
41
38
 
42
39
  link :self do
@@ -44,7 +41,7 @@ module PactBroker
44
41
  end
45
42
 
46
43
  links :pacticipants do
47
- collect{ | pacticipant | {:href => pacticipant_url(pacticipant), :name => pacticipant.name } }
44
+ represented.collect{ | pacticipant | {:href => pacticipant_url(pacticipant), :name => pacticipant.name } }
48
45
  end
49
46
 
50
47
  end
@@ -0,0 +1,32 @@
1
+ require_relative 'base_decorator'
2
+ require_relative 'version_decorator'
3
+
4
+ module PactBroker
5
+
6
+ module Api
7
+
8
+ module Decorators
9
+
10
+ class PacticipantRepresenter < BaseDecorator
11
+
12
+ property :name
13
+ property :repository_url
14
+
15
+ property :last_version, :class => PactBroker::Models::Version, :extend => PactBroker::Api::Decorators::VersionRepresenter, :embedded => true
16
+
17
+ link :self do
18
+ pacticipant_url(represented)
19
+ end
20
+
21
+ link :last_version do
22
+ last_version_url(represented)
23
+ end
24
+
25
+ link :versions do
26
+ versions_url(represented)
27
+ end
28
+
29
+ end
30
+ end
31
+ end
32
+ end
@@ -2,7 +2,7 @@ require 'ostruct'
2
2
 
3
3
  module PactBroker
4
4
  module Api
5
- module Representors
5
+ module Decorators
6
6
  class RepresentablePact
7
7
 
8
8
  attr_reader :consumer, :provider, :consumer_version
@@ -0,0 +1,16 @@
1
+ require_relative 'base_decorator'
2
+
3
+ module PactBroker
4
+ module Api
5
+ module Decorators
6
+ class VersionRepresenter < BaseDecorator
7
+
8
+ property :number
9
+
10
+ link :self do
11
+ version_url(represented)
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -1,4 +1,5 @@
1
1
  require 'sequel'
2
+ require 'pact_broker/logging'
2
3
 
3
4
  module PactBroker
4
5
  module Repositories
@@ -1,18 +1,11 @@
1
1
  require 'webmachine'
2
- require 'json'
2
+ require 'pact_broker/services'
3
+ require 'pact_broker/api/decorators'
3
4
 
4
5
  module PactBroker
5
6
 
6
7
  module Resources
7
8
 
8
- module PathInfo
9
- def identifier_from_path
10
- request.path_info.each_with_object({}) do | pair, hash|
11
- hash[pair.first] = CGI::unescape(pair.last)
12
- end
13
- end
14
- end
15
-
16
9
  class ErrorHandler
17
10
  def self.handle_exception e, response
18
11
  response.body = {:message => e.message, :backtrace => e.backtrace }.to_json
@@ -20,13 +13,18 @@ module PactBroker
20
13
  end
21
14
  end
22
15
 
23
- class JsonResource < Webmachine::Resource
24
- def content_types_provided
25
- [["application/json", :to_json]]
16
+ class BaseResource < Webmachine::Resource
17
+
18
+ include PactBroker::Services
19
+
20
+ def identifier_from_path
21
+ request.path_info.each_with_object({}) do | pair, hash|
22
+ hash[pair.first] = CGI::unescape(pair.last)
23
+ end
26
24
  end
27
25
 
28
- def content_types_accepted
29
- [["application/json", :from_json]]
26
+ def request_base_url
27
+ request.uri.to_s.gsub(/#{request.uri.path}$/,'')
30
28
  end
31
29
 
32
30
  def handle_exception e
@@ -1,17 +1,10 @@
1
- require 'webmachine'
2
- require 'json'
3
-
4
- require 'pact_broker/services'
5
- require 'pact_broker/resources/json_resource'
1
+ require 'pact_broker/resources/base_resource'
6
2
 
7
3
  module PactBroker
8
4
 
9
5
  module Resources
10
6
 
11
- class LatestPact < Webmachine::Resource
12
-
13
- include PactBroker::Services
14
- include PactBroker::Resources::PathInfo
7
+ class LatestPact < BaseResource
15
8
 
16
9
  def content_types_provided
17
10
  [["application/json", :to_json]]
@@ -31,10 +24,6 @@ module PactBroker
31
24
  @pact.json_content
32
25
  end
33
26
 
34
- def handle_exception e
35
- PactBroker::Resources::ErrorHandler.handle_exception(e, response)
36
- end
37
-
38
27
  end
39
28
  end
40
29
 
@@ -1,20 +1,11 @@
1
- require 'webmachine'
2
- require 'json'
3
-
4
- require 'pact_broker/services'
5
- require 'pact_broker/resources/json_resource'
6
-
7
- require 'pact_broker/api/representors/representable_pact'
1
+ require 'pact_broker/resources/base_resource'
8
2
 
9
3
  module PactBroker
10
4
 
11
5
  module Resources
12
6
 
13
- class LatestPacts < Webmachine::Resource
7
+ class LatestPacts < BaseResource
14
8
 
15
- include PactBroker::Services
16
-
17
- #FIX to hal+json
18
9
  def content_types_provided
19
10
  [["application/hal+json", :to_json]]
20
11
  end
@@ -28,19 +19,7 @@ module PactBroker
28
19
  end
29
20
 
30
21
  def generate_json pacts
31
- pacts = pacts.collect{ | pact | create_representable_pact(pact) }
32
- pacts.extend(PactBroker::Api::Representors::PactCollectionRepresenter)
33
- pacts.to_json
34
- end
35
-
36
- def handle_exception e
37
- PactBroker::Resources::ErrorHandler.handle_exception(e, response)
38
- end
39
-
40
- private
41
-
42
- def create_representable_pact pact
43
- PactBroker::Api::Representors::RepresentablePact.new(pact)
22
+ PactBroker::Api::Decorators::PactCollectionRepresenter.new(pacts, request_base_url).to_json
44
23
  end
45
24
 
46
25
  end
@@ -1,18 +1,19 @@
1
- require 'webmachine'
2
- require 'json'
3
1
  require 'cgi'
4
-
5
- require 'pact_broker/services'
6
- require 'pact_broker/resources/json_resource'
2
+ require 'pact_broker/resources/base_resource'
7
3
 
8
4
  module PactBroker
9
5
 
10
6
  module Resources
11
7
 
12
- class Pact < JsonResource
8
+ class Pact < BaseResource
9
+
10
+ def content_types_provided
11
+ [["application/json", :to_json]]
12
+ end
13
13
 
14
- include PactBroker::Services
15
- include PactBroker::Resources::PathInfo
14
+ def content_types_accepted
15
+ [["application/json", :from_json]]
16
+ end
16
17
 
17
18
  def allowed_methods
18
19
  ["GET", "PUT"]
@@ -1,19 +1,18 @@
1
- require 'webmachine'
2
- require 'json'
3
- require 'cgi'
1
+ require 'pact_broker/resources/base_resource'
4
2
 
5
- require 'pact_broker/services'
6
- require 'pact_broker/resources/json_resource'
7
- require 'pact_broker/api/representors'
3
+ module Webmachine
4
+ class Request
5
+ def put?
6
+ method == "PUT" || method == "PATCH"
7
+ end
8
+ end
9
+ end
8
10
 
9
11
  module PactBroker
10
12
 
11
13
  module Resources
12
14
 
13
- class Pacticipant < Webmachine::Resource
14
-
15
- include PactBroker::Services
16
- include PactBroker::Resources::PathInfo
15
+ class Pacticipant < BaseResource
17
16
 
18
17
  def content_types_provided
19
18
  [["application/hal+json", :to_json]]
@@ -23,10 +22,6 @@ module PactBroker
23
22
  [["application/json", :from_json]]
24
23
  end
25
24
 
26
- def handle_exception e
27
- PactBroker::Resources::ErrorHandler.handle_exception(e, response)
28
- end
29
-
30
25
  def allowed_methods
31
26
  ["GET", "PATCH"]
32
27
  end
@@ -44,30 +39,23 @@ module PactBroker
44
39
  response.body = generate_json(pacticipant)
45
40
  end
46
41
 
42
+ def resource_exists?
43
+ @pacticipant = pacticipant_service.find_pacticipant_by_name(identifier_from_path[:name])
44
+ @pacticipant != nil
45
+ end
46
+
47
47
  def finish_request
48
48
  if @manual_response_code
49
49
  response.code = @manual_response_code
50
50
  end
51
51
  end
52
52
 
53
- def resource_exists?
54
- #Terrible hack to allow Webmachine to continue when a PATCH is used - does not seem to support it
55
- if request.method == 'PATCH'
56
- def request.method
57
- 'PUT'
58
- end
59
- end
60
- @pacticipant = pacticipant_service.find_pacticipant_by_name(identifier_from_path[:name])
61
- @pacticipant != nil
62
- end
63
-
64
53
  def to_json
65
54
  generate_json(@pacticipant)
66
55
  end
67
56
 
68
57
  def generate_json pacticipant
69
- pacticipant.extend(PactBroker::Api::Representors::PacticipantRepresenter)
70
- pacticipant.to_json
58
+ PactBroker::Api::Decorators::PacticipantRepresenter.new(pacticipant, request_base_url).to_json
71
59
  end
72
60
 
73
61
  def params
@@ -1,27 +1,15 @@
1
- require 'webmachine'
2
- require 'json'
3
-
4
- require 'pact_broker/services'
5
- require 'pact_broker/resources/json_resource'
6
- require 'pact_broker/api/representors'
1
+ require 'pact_broker/resources/base_resource'
7
2
 
8
3
  module PactBroker
9
4
 
10
5
  module Resources
11
6
 
12
- class Pacticipants < Webmachine::Resource
13
-
14
- include PactBroker::Services
15
- include PactBroker::Resources::PathInfo
7
+ class Pacticipants < BaseResource
16
8
 
17
9
  def content_types_provided
18
10
  [["application/hal+json", :to_json]]
19
11
  end
20
12
 
21
- def handle_exception e
22
- PactBroker::Resources::ErrorHandler.handle_exception(e, response)
23
- end
24
-
25
13
  def allowed_methods
26
14
  ["GET"]
27
15
  end
@@ -31,8 +19,7 @@ module PactBroker
31
19
  end
32
20
 
33
21
  def generate_json pacticipants
34
- pacticipants.extend(PactBroker::Api::Representors::PacticipantCollectionRepresenter)
35
- pacticipants.to_json
22
+ PactBroker::Api::Decorators::PacticipantCollectionRepresenter.new(pacticipants, request_base_url).to_json
36
23
  end
37
24
 
38
25
  end
@@ -1,3 +1,3 @@
1
1
  module PactBroker
2
- VERSION = '0.0.5'
2
+ VERSION = '0.0.6'
3
3
  end
@@ -1,9 +1,9 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  require 'pact_broker/models'
4
- require 'pact_broker/api/representors'
4
+ require 'pact_broker/api/decorators'
5
5
 
6
- module PactBroker::Api::Representors
6
+ module PactBroker::Api::Decorators
7
7
 
8
8
  describe PactCollectionRepresenter do
9
9
 
@@ -16,7 +16,7 @@ module PactBroker::Api::Representors
16
16
  end
17
17
 
18
18
  xit "should description" do
19
- puts [pact].extend(PactCollectionRepresenter).to_json
19
+ puts PactCollectionRepresenter.new([pact]).to_json
20
20
  end
21
21
  end
22
22
 
@@ -1,8 +1,8 @@
1
1
  require 'spec_helper'
2
2
  require 'spec/support/provider_state_builder'
3
- require 'pact_broker/api/representors/representable_pact'
3
+ require 'pact_broker/api/decorators/representable_pact'
4
4
 
5
- module PactBroker::Api::Representors
5
+ module PactBroker::Api::Decorators
6
6
  describe RepresentablePact do
7
7
  let(:pact) { ProviderStateBuilder.new.create_pact_with_hierarchy 'Consumer', '1.2.3', 'Provider' }
8
8
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pact_broker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-11-12 00:00:00.000000000 Z
14
+ date: 2013-11-14 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: httparty
@@ -297,16 +297,16 @@ files:
297
297
  - db/pact_broker_database.sqlite3
298
298
  - lib/pact_broker.rb
299
299
  - lib/pact_broker/api.rb
300
- - lib/pact_broker/api/representors.rb
301
- - lib/pact_broker/api/representors/pact_broker_urls.rb
302
- - lib/pact_broker/api/representors/pact_collection_representor.rb
303
- - lib/pact_broker/api/representors/pact_pacticipant_representor.rb
304
- - lib/pact_broker/api/representors/pact_representor.rb
305
- - lib/pact_broker/api/representors/pacticipant_collection_representor.rb
306
- - lib/pact_broker/api/representors/pacticipant_empty_collection_representor.rb
307
- - lib/pact_broker/api/representors/pacticipant_representor.rb
308
- - lib/pact_broker/api/representors/representable_pact.rb
309
- - lib/pact_broker/api/representors/version_representor.rb
300
+ - lib/pact_broker/api/decorators.rb
301
+ - lib/pact_broker/api/decorators/base_decorator.rb
302
+ - lib/pact_broker/api/decorators/pact_broker_urls.rb
303
+ - lib/pact_broker/api/decorators/pact_collection_decorator.rb
304
+ - lib/pact_broker/api/decorators/pact_decorator.rb
305
+ - lib/pact_broker/api/decorators/pact_pacticipant_decorator.rb
306
+ - lib/pact_broker/api/decorators/pacticipant_collection_decorator.rb
307
+ - lib/pact_broker/api/decorators/pacticipant_decorator.rb
308
+ - lib/pact_broker/api/decorators/representable_pact.rb
309
+ - lib/pact_broker/api/decorators/version_decorator.rb
310
310
  - lib/pact_broker/db.rb
311
311
  - lib/pact_broker/logging.rb
312
312
  - lib/pact_broker/models.rb
@@ -319,7 +319,7 @@ files:
319
319
  - lib/pact_broker/repositories/pact_repository.rb
320
320
  - lib/pact_broker/repositories/pacticipant_repository.rb
321
321
  - lib/pact_broker/repositories/version_repository.rb
322
- - lib/pact_broker/resources/json_resource.rb
322
+ - lib/pact_broker/resources/base_resource.rb
323
323
  - lib/pact_broker/resources/latest_pact.rb
324
324
  - lib/pact_broker/resources/latest_pacts.rb
325
325
  - lib/pact_broker/resources/pact.rb
@@ -334,8 +334,8 @@ files:
334
334
  - lib/pact_broker/version.rb
335
335
  - pact_broker.gemspec
336
336
  - pact_broker_client-pact_broker.json
337
- - spec/lib/pact_broker/api/representors/pact_collection_representor_spec.rb
338
- - spec/lib/pact_broker/api/representors/representable_pact_spec.rb
337
+ - spec/lib/pact_broker/api/decorators/pact_collection_decorator_spec.rb
338
+ - spec/lib/pact_broker/api/decorators/representable_pact_spec.rb
339
339
  - spec/lib/pact_broker/models/order_versions_spec.rb
340
340
  - spec/lib/pact_broker/repositories/pact_repository_spec.rb
341
341
  - spec/service_consumers/pact_helper.rb
@@ -360,7 +360,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
360
360
  version: '0'
361
361
  segments:
362
362
  - 0
363
- hash: -4108477113553903119
363
+ hash: 3334088908397739735
364
364
  required_rubygems_version: !ruby/object:Gem::Requirement
365
365
  none: false
366
366
  requirements:
@@ -369,7 +369,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
369
369
  version: '0'
370
370
  segments:
371
371
  - 0
372
- hash: -4108477113553903119
372
+ hash: 3334088908397739735
373
373
  requirements: []
374
374
  rubyforge_project:
375
375
  rubygems_version: 1.8.23
@@ -377,8 +377,8 @@ signing_key:
377
377
  specification_version: 3
378
378
  summary: See description
379
379
  test_files:
380
- - spec/lib/pact_broker/api/representors/pact_collection_representor_spec.rb
381
- - spec/lib/pact_broker/api/representors/representable_pact_spec.rb
380
+ - spec/lib/pact_broker/api/decorators/pact_collection_decorator_spec.rb
381
+ - spec/lib/pact_broker/api/decorators/representable_pact_spec.rb
382
382
  - spec/lib/pact_broker/models/order_versions_spec.rb
383
383
  - spec/lib/pact_broker/repositories/pact_repository_spec.rb
384
384
  - spec/service_consumers/pact_helper.rb
@@ -1,6 +0,0 @@
1
- require 'pact_broker/api/representors/pacticipant_representor'
2
- require 'pact_broker/api/representors/pacticipant_collection_representor'
3
- require 'pact_broker/api/representors/version_representor'
4
- require 'pact_broker/api/representors/pact_collection_representor'
5
- require 'pact_broker/api/representors/pact_pacticipant_representor'
6
- require 'pact_broker/api/representors/pact_representor'
@@ -1,34 +0,0 @@
1
- require 'roar/representer/json/hal'
2
- require_relative 'pact_broker_urls'
3
- require_relative 'version_representor'
4
- require_relative 'pact_representor'
5
-
6
- module PactBroker
7
-
8
- module Api
9
-
10
- module Representors
11
-
12
- module PactCollectionRepresenter
13
- include Roar::Representer::JSON::HAL
14
- include PactBroker::Api::PactBrokerUrls
15
-
16
-
17
- collection :pacts, :class => PactBroker::Models::Pact, :extend => PactBroker::Api::Representors::PactRepresenter
18
-
19
- def pacts
20
- self
21
- end
22
-
23
- link :self do
24
- latest_pacts_url
25
- end
26
-
27
- links :pacts do
28
- collect{ | pact | {:href => pact_url(pact) } }
29
- end
30
-
31
- end
32
- end
33
- end
34
- end
@@ -1,27 +0,0 @@
1
- require 'roar/representer/json/hal'
2
- require_relative 'pact_broker_urls'
3
- require_relative 'version_representor'
4
-
5
- module PactBroker
6
-
7
- module Api
8
-
9
- module Representors
10
-
11
- module PactPacticipantRepresenter
12
- include Roar::Representer::JSON::HAL
13
- include Roar::Representer::JSON::HAL::Links
14
- include PactBroker::Api::PactBrokerUrls
15
-
16
- property :name
17
- property :repository_url
18
- property :version, :class => "PactBroker::Models::Version", :extend => PactBroker::Api::Representors::VersionRepresenter, :embedded => true
19
-
20
- link :self do
21
- pacticipant_url(self)
22
- end
23
-
24
- end
25
- end
26
- end
27
- end
@@ -1,27 +0,0 @@
1
- require 'roar/representer/json/hal'
2
- require_relative 'pact_broker_urls'
3
- require_relative 'pact_pacticipant_representor'
4
-
5
- module PactBroker
6
-
7
- module Api
8
-
9
- module Representors
10
-
11
- module PactRepresenter
12
- include Roar::Representer::JSON::HAL
13
- include Roar::Representer::JSON::HAL::Links
14
- include PactBroker::Api::PactBrokerUrls
15
-
16
-
17
- property :consumer, :extend => PactBroker::Api::Representors::PactPacticipantRepresenter, :embedded => true
18
- property :provider, :extend => PactBroker::Api::Representors::PactPacticipantRepresenter, :embedded => true
19
-
20
- link :self do
21
- pact_url(self)
22
- end
23
-
24
- end
25
- end
26
- end
27
- end
@@ -1,33 +0,0 @@
1
- require 'roar/representer/json/hal'
2
- require_relative 'pact_broker_urls'
3
- require_relative 'version_representor'
4
-
5
- module PactBroker
6
-
7
- module Api
8
-
9
- module Representors
10
-
11
- module PacticipantCollectionRepresenter
12
- include Roar::Representer::JSON::HAL
13
- include PactBroker::Api::PactBrokerUrls
14
-
15
-
16
- collection :pacticipants, :class => PactBroker::Models::Pacticipant, :extend => PactBroker::Api::Representors::PacticipantRepresenter
17
-
18
- def pacticipants
19
- self
20
- end
21
-
22
- link :self do
23
- pacticipants_url
24
- end
25
-
26
- links :pacticipants do
27
- collect{ | pacticipant | {:href => pacticipant_url(pacticipant), :name => pacticipant.name } }
28
- end
29
-
30
- end
31
- end
32
- end
33
- end
@@ -1,35 +0,0 @@
1
- require 'roar/representer/json/hal'
2
- require_relative 'pact_broker_urls'
3
- require_relative 'version_representor'
4
-
5
- module PactBroker
6
-
7
- module Api
8
-
9
- module Representors
10
-
11
- module PacticipantRepresenter
12
- include Roar::Representer::JSON::HAL
13
- include Roar::Representer::JSON::HAL::Links
14
- include PactBroker::Api::PactBrokerUrls
15
-
16
- property :name
17
- property :repository_url
18
-
19
- property :last_version, :class => PactBroker::Models::Version, :extend => PactBroker::Api::Representors::VersionRepresenter, :embedded => true
20
-
21
- link :self do
22
- pacticipant_url(self)
23
- end
24
-
25
- link :last_version do
26
- last_version_url(self)
27
- end
28
-
29
- link :versions do
30
- versions_url(self)
31
- end
32
- end
33
- end
34
- end
35
- end
@@ -1,20 +0,0 @@
1
- require 'roar/representer/json/hal'
2
- require_relative 'pact_broker_urls'
3
-
4
- module PactBroker
5
- module Api
6
- module Representors
7
- module VersionRepresenter
8
- include Roar::Representer::JSON::HAL
9
- include Roar::Representer::JSON::HAL::Links
10
- include PactBroker::Api::PactBrokerUrls
11
-
12
- property :number
13
-
14
- link :self do
15
- version_url(self)
16
- end
17
- end
18
- end
19
- end
20
- end