pact_broker 1.3.1 → 1.3.2.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/README.md +12 -0
- data/db/migrations/07_increase_json_content_length.rb +3 -7
- data/db/migrations/15_add_value_to_tag.rb.wip +5 -0
- data/db/migrations/15_create_pact_version_content.rb +13 -0
- data/db/migrations/16_add_pact_content_foreign_key_to_pacts.rb +10 -0
- data/db/migrations/17_migrate_json_content_to_pact_version_content_table.rb +14 -0
- data/db/migrations/18_drop_json_content_column_from_pacts.rb +14 -0
- data/db/migrations/19_make_pact_version_content_sha_not_nullable.rb +10 -0
- data/db/migrations/20_add_pact_version_content_sha_to_all_pacts_view.rb +18 -0
- data/db/migrations/21_recreate_latest_pacts_view.rb +21 -0
- data/db/migrations/migration_helper.rb +15 -0
- data/db/pact_broker_database.sqlite3 +0 -0
- data/example/config.ru +5 -1
- data/example/pact_broker_database.sqlite3 +0 -0
- data/lib/pact_broker/api/decorators/pact_collection_decorator.rb +1 -1
- data/lib/pact_broker/api/decorators/pact_pacticipant_decorator.rb +1 -1
- data/lib/pact_broker/api/decorators/pacticipant_collection_decorator.rb +1 -1
- data/lib/pact_broker/api/decorators/pacticipant_decorator.rb +1 -1
- data/lib/pact_broker/api/decorators/relationships_csv_decorator.rb +1 -1
- data/lib/pact_broker/api/decorators/webhook_decorator.rb +2 -2
- data/lib/pact_broker/api/renderers/html_pact_renderer.rb +1 -1
- data/lib/pact_broker/api/resources/pact.rb +8 -1
- data/lib/pact_broker/api/resources/pact_webhooks.rb +1 -1
- data/lib/pact_broker/api/resources/pacticipants.rb +2 -2
- data/lib/pact_broker/db/validate_encoding.rb +22 -0
- data/lib/pact_broker/doc/views/pacticipants.markdown +3 -1
- data/lib/pact_broker/domain.rb +5 -0
- data/lib/pact_broker/{models → domain}/group.rb +1 -1
- data/lib/pact_broker/{models → domain}/order_versions.rb +2 -2
- data/lib/pact_broker/{models → domain}/pact.rb +1 -1
- data/lib/pact_broker/{models → domain}/pacticipant.rb +1 -1
- data/lib/pact_broker/{models → domain}/relationship.rb +1 -1
- data/lib/pact_broker/{models → domain}/tag.rb +2 -2
- data/lib/pact_broker/{models → domain}/version.rb +3 -3
- data/lib/pact_broker/{models → domain}/webhook.rb +2 -2
- data/lib/pact_broker/{models → domain}/webhook_execution_result.rb +1 -1
- data/lib/pact_broker/{models → domain}/webhook_request.rb +3 -3
- data/lib/pact_broker/{models → domain}/webhook_request_header.rb +1 -1
- data/lib/pact_broker/functions/find_potential_duplicate_pacticipant_names.rb +1 -1
- data/lib/pact_broker/functions/groupify.rb +2 -2
- data/lib/pact_broker/locale/en.yml +1 -0
- data/lib/pact_broker/pacts/all_pacts.rb +82 -0
- data/lib/pact_broker/pacts/database_model.rb +35 -0
- data/lib/pact_broker/pacts/latest_pacts.rb +11 -0
- data/lib/pact_broker/pacts/pact_version_content.rb +11 -0
- data/lib/pact_broker/pacts/repository.rb +106 -0
- data/lib/pact_broker/repositories.rb +3 -3
- data/lib/pact_broker/repositories/pacticipant_repository.rb +6 -6
- data/lib/pact_broker/repositories/tag_repository.rb +3 -3
- data/lib/pact_broker/repositories/version_repository.rb +5 -5
- data/lib/pact_broker/repositories/webhook.rb +89 -0
- data/lib/pact_broker/repositories/webhook_repository.rb +9 -94
- data/lib/pact_broker/services/pact_service.rb +4 -0
- data/lib/pact_broker/services/pacticipant_service.rb +3 -3
- data/lib/pact_broker/ui.rb +7 -0
- data/lib/pact_broker/ui/controllers/clusters.rb +1 -1
- data/lib/pact_broker/ui/controllers/relationships.rb +1 -1
- data/lib/pact_broker/ui/view_models/relationship.rb +1 -1
- data/lib/pact_broker/ui/view_models/relationships.rb +12 -3
- data/lib/pact_broker/ui/views/relationships/show.haml +2 -0
- data/lib/pact_broker/version.rb +1 -1
- data/public/stylesheets/relationships.css +5 -0
- data/spec/features/create_webhook_spec.rb +77 -0
- data/spec/features/delete_pact_spec.rb +28 -0
- data/spec/features/publish_pact_spec.rb +58 -0
- data/spec/features/update_pacticipant_spec.rb +26 -0
- data/spec/fixtures/update_pacticipant.json +5 -0
- data/spec/fixtures/updated_pacticipant.json +11 -0
- data/spec/integration/app_spec.rb +1 -4
- data/spec/lib/pact_broker/api/contracts/webhook_contract_spec.rb +1 -1
- data/spec/lib/pact_broker/api/decorators/pact_collection_decorator_spec.rb +5 -5
- data/spec/lib/pact_broker/api/decorators/pact_decorator_spec.rb +3 -3
- data/spec/lib/pact_broker/api/decorators/pact_version_decorator_spec.rb +3 -3
- data/spec/lib/pact_broker/api/decorators/pacticipant_decorator_spec.rb +2 -2
- data/spec/lib/pact_broker/api/decorators/webhook_decorator_spec.rb +6 -6
- data/spec/lib/pact_broker/api/decorators/webhook_execution_result_decorator_spec.rb +2 -2
- data/spec/lib/pact_broker/api/decorators/webhook_request_decorator_spec.rb +2 -2
- data/spec/lib/pact_broker/api/decorators/webhooks_decorator_spec.rb +1 -1
- data/spec/lib/pact_broker/api/renderers/html_pact_renderer_spec.rb +1 -1
- data/spec/lib/pact_broker/api/resources/pact_spec.rb +34 -1
- data/spec/lib/pact_broker/api/resources/pact_webhooks_spec.rb +3 -3
- data/spec/lib/pact_broker/api/resources/pacticipants_spec.rb +1 -1
- data/spec/lib/pact_broker/api/resources/tag_spec.rb +1 -1
- data/spec/lib/pact_broker/db/validate_encoding_spec.rb +66 -0
- data/spec/lib/pact_broker/{models → domain}/group_spec.rb +5 -5
- data/spec/lib/pact_broker/{models → domain}/order_versions_spec.rb +4 -4
- data/spec/lib/pact_broker/{models → domain}/pacticipant_spec.rb +2 -2
- data/spec/lib/pact_broker/{models → domain}/webhook_request_spec.rb +2 -2
- data/spec/lib/pact_broker/{models → domain}/webhook_spec.rb +3 -3
- data/spec/lib/pact_broker/functions/groupify_spec.rb +10 -10
- data/spec/lib/pact_broker/{repositories/pact_repository_spec.rb → pacts/repository_spec.rb} +128 -28
- data/spec/lib/pact_broker/repositories/webhook_repository_spec.rb +3 -3
- data/spec/lib/pact_broker/services/group_service_spec.rb +4 -4
- data/spec/lib/pact_broker/services/pact_service_spec.rb +4 -4
- data/spec/lib/pact_broker/services/pacticipant_service_spec.rb +11 -11
- data/spec/lib/pact_broker/services/webhook_service_spec.rb +5 -5
- data/spec/lib/pact_broker/ui/controllers/relationships_spec.rb +3 -3
- data/spec/lib/pact_broker/ui/view_models/relationship_spec.rb +8 -8
- data/spec/lib/pact_broker/ui/view_models/relationships_spec.rb +28 -5
- data/spec/support/provider_state_builder.rb +17 -17
- data/tasks/db.rake +1 -2
- metadata +59 -35
- data/lib/pact_broker/jobs/after_pact_save.rb +0 -13
- data/lib/pact_broker/models.rb +0 -5
- data/lib/pact_broker/repositories/pact.rb +0 -29
- data/lib/pact_broker/repositories/pact_repository.rb +0 -140
- data/spec/integration/endpoints/pact_put_spec.rb +0 -59
- data/spec/integration/endpoints/pact_webhooks_spec.rb +0 -96
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73c13ba9bbfe6c1ec7ad64a93f145bd164894f13
|
4
|
+
data.tar.gz: 1938f955d3f2d67b4b0929040dfc6fbfb3645c47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c539c2e7434b3572172aeef0b22de80ab5bddd506e48e6819d77d6579bc6f2935b8b53d5c63862e9ef7cff63ee56dd6337267033baa5dafbb5b76731e8e055f
|
7
|
+
data.tar.gz: fefad6d9bec291eaba9e99a3e52bb2632d25e900e6bf275d0b4dbd0ded33ec9388daf0e3054739c47c39e41d6d69c532c6542506df1678672867e5ddb683bed7
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,17 @@ Do this to generate your change history
|
|
2
2
|
|
3
3
|
$ git log --pretty=format:' * %h - %s (%an, %ad)'
|
4
4
|
|
5
|
+
#### 1.3.2.rc1 (2014-12-03)
|
6
|
+
|
7
|
+
* a2413f4 - Stop Padrino trying to create a log file in the gem directory https://github.com/bethesque/pact_broker/issues/13 (Beth, Wed Dec 3 13:16:06 2014 +1100)
|
8
|
+
* abf9459 - Added DELETE endpoint for pact resource (Beth, Wed Nov 19 17:45:34 2014 +1100)
|
9
|
+
* 1d01937 - Set default encoding to utf-8 in example app. This is required for the sha foreign key to work between the pact table and the pact_version_content table. (Beth, Tue Nov 18 22:35:51 2014 +1100)
|
10
|
+
* 9e3401e - Save all the space! Reuse the same pact_version_content when one with the same sha1 already exists in the database. (Beth, Tue Nov 18 20:27:59 2014 +1100)
|
11
|
+
* 84ab8ad - Creating example pact_broker_database.sqlite3 with the Zoo App/Animal Service pact (Beth, Tue Nov 18 17:30:25 2014 +1100)
|
12
|
+
* d767b0d - Fixed query for all pacts when pact has more than one tag (Beth, Mon Nov 17 20:44:01 2014 +1100)
|
13
|
+
* 21563c6 - Changed date to use day name and month name instead of numbers (Beth, Wed Nov 12 16:19:19 2014 +1100)
|
14
|
+
* 7766b77 - Added count to relationships page. (Beth, Mon Nov 3 11:06:05 2014 +1100)
|
15
|
+
|
5
16
|
#### 1.3.1 (2014-10-23)
|
6
17
|
|
7
18
|
* e61b40e - Added Travis configuration. (Beth, Fri Oct 17 16:32:26 2014 +1100)
|
data/README.md
CHANGED
@@ -14,6 +14,17 @@ The Pact Broker:
|
|
14
14
|
|
15
15
|
See the [Pact Broker Client](https://github.com/bethesque/pact_broker-client) for documentation on how to publish a pact to the Pact Broker, and configure the URLs in the provider project.
|
16
16
|
|
17
|
+
### Screenshots
|
18
|
+
|
19
|
+
#### Index
|
20
|
+
<img src="https://raw.githubusercontent.com/wiki/bethesque/pact_broker/images/index.png"/>
|
21
|
+
|
22
|
+
#### Autogenerated documentation
|
23
|
+
<img src="https://raw.githubusercontent.com/wiki/bethesque/pact_broker/images/autogenerated_documentation.png"/>
|
24
|
+
|
25
|
+
#### Network diagram
|
26
|
+
<img src="https://raw.githubusercontent.com/wiki/bethesque/pact_broker/images/network_diagram.png"/>
|
27
|
+
|
17
28
|
## Documentation
|
18
29
|
|
19
30
|
See the [wiki](https://github.com/bethesque/pact_broker/wiki) for documentation.
|
@@ -25,6 +36,7 @@ See the [wiki](https://github.com/bethesque/pact_broker/wiki) for documentation.
|
|
25
36
|
* Install ruby 1.9.3 or later
|
26
37
|
* Copy the [example](/example) directory to your workstation.
|
27
38
|
* Modify the config.ru and Gemfile as desired (eg. choose database driver gem, set your database credentials)
|
39
|
+
* Please ensure you use `encoding: 'utf8'` in your Sequel options to avoid encoding issues.
|
28
40
|
* Run `bundle`
|
29
41
|
* Run `bundle exec rackup`
|
30
42
|
* Open [http://localhost:9292](http://localhost:9292) and you should see the HAL browser.
|
@@ -1,13 +1,9 @@
|
|
1
|
+
require_relative 'migration_helper'
|
2
|
+
|
1
3
|
Sequel.migration do
|
2
4
|
change do
|
3
5
|
alter_table(:pacts) do
|
4
|
-
|
5
|
-
set_column_type(:json_content, :text)
|
6
|
-
else
|
7
|
-
# Assume mysql
|
8
|
-
set_column_type(:json_content, :mediumtext)
|
9
|
-
end
|
6
|
+
set_column_type(:json_content, PactBroker::MigrationHelper.large_text_type)
|
10
7
|
end
|
11
8
|
end
|
12
9
|
end
|
13
|
-
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'digest/sha1'
|
2
|
+
require_relative 'migration_helper'
|
3
|
+
|
4
|
+
Sequel.migration do
|
5
|
+
change do
|
6
|
+
create_table(:pact_version_contents) do
|
7
|
+
String :sha, primary_key: true, null: false, primary_key_constraint_name: 'pk_pact_version_contents'
|
8
|
+
String :content, type: PactBroker::MigrationHelper.large_text_type
|
9
|
+
DateTime :created_at, null: false
|
10
|
+
DateTime :updated_at, null: false
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'digest/sha1'
|
2
|
+
require_relative 'migration_helper'
|
3
|
+
|
4
|
+
Sequel.migration do
|
5
|
+
change do
|
6
|
+
alter_table(:pacts) do
|
7
|
+
add_foreign_key :pact_version_content_sha, :pact_version_contents, type: String, null: true, foreign_key_constraint_name: 'fk_pact_version_content'
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'digest/sha1'
|
2
|
+
require_relative 'migration_helper'
|
3
|
+
|
4
|
+
Sequel.migration do
|
5
|
+
change do
|
6
|
+
self[:pacts].each do | row |
|
7
|
+
sha = Digest::SHA1.hexdigest(row[:json_content])
|
8
|
+
if self[:pact_version_contents].where(sha: sha).count == 0
|
9
|
+
self[:pact_version_contents].insert(sha: sha, content: row[:json_content], created_at: row[:created_at], updated_at: row[:updated_at])
|
10
|
+
end
|
11
|
+
self[:pacts].where(id: row[:id]).update(pact_version_content_sha: sha)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'digest/sha1'
|
2
|
+
require_relative 'migration_helper'
|
3
|
+
|
4
|
+
Sequel.migration do
|
5
|
+
change do
|
6
|
+
drop_view(:latest_pacts)
|
7
|
+
drop_view(:latest_pact_consumer_version_orders)
|
8
|
+
drop_view(:all_pacts)
|
9
|
+
|
10
|
+
alter_table(:pacts) do
|
11
|
+
drop_column(:json_content)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'digest/sha1'
|
2
|
+
require_relative 'migration_helper'
|
3
|
+
|
4
|
+
Sequel.migration do
|
5
|
+
change do
|
6
|
+
create_or_replace_view(:all_pacts,
|
7
|
+
Sequel::Model.db[:pacts].select(:pacts__id,
|
8
|
+
:c__id___consumer_id, :c__name___consumer_name,
|
9
|
+
:cv__id___consumer_version_id, :cv__number___consumer_version_number, :cv__order___consumer_version_order,
|
10
|
+
:p__id___provider_id, :p__name___provider_name,
|
11
|
+
:pvc__sha___pact_version_content_sha, :pacts__created_at, :pacts__updated_at).
|
12
|
+
join(:versions, {:id => :version_id}, {:table_alias => :cv, implicit_qualifier: :pacts}).
|
13
|
+
join(:pacticipants, {:id => :pacticipant_id}, {:table_alias => :c, implicit_qualifier: :cv}).
|
14
|
+
join(:pacticipants, {:id => :provider_id}, {:table_alias => :p, implicit_qualifier: :pacts}).
|
15
|
+
join(:pact_version_contents, {:sha => :pact_version_content_sha}, {:table_alias => :pvc, implicit_qualifier: :pacts})
|
16
|
+
)
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'digest/sha1'
|
2
|
+
require_relative 'migration_helper'
|
3
|
+
|
4
|
+
Sequel.migration do
|
5
|
+
change do
|
6
|
+
create_or_replace_view(:latest_pact_consumer_version_orders,
|
7
|
+
"select provider_id, consumer_id, max(consumer_version_order) as latest_consumer_version_order
|
8
|
+
from all_pacts
|
9
|
+
group by provider_id, consumer_id"
|
10
|
+
)
|
11
|
+
|
12
|
+
create_or_replace_view(:latest_pacts,
|
13
|
+
"select ap.*
|
14
|
+
from all_pacts ap
|
15
|
+
inner join latest_pact_consumer_version_orders lp
|
16
|
+
on ap.consumer_id = lp.consumer_id
|
17
|
+
and ap.provider_id = lp.provider_id
|
18
|
+
and ap.consumer_version_order = latest_consumer_version_order"
|
19
|
+
)
|
20
|
+
end
|
21
|
+
end
|
Binary file
|
data/example/config.ru
CHANGED
@@ -4,7 +4,11 @@ require 'sequel'
|
|
4
4
|
require 'pact_broker'
|
5
5
|
|
6
6
|
# Create a real database, and set the credentials for it here
|
7
|
-
|
7
|
+
# It is highly recommended to set the encoding to utf8 (varchar foreign keys may blow up otherwise)
|
8
|
+
DATABASE_CREDENTIALS = {database: "pact_broker_database.sqlite3", adapter: "sqlite", :encoding => 'utf8'}
|
9
|
+
|
10
|
+
# Have a look at the Sequel documentation to make decisions about things like connection pooling
|
11
|
+
# and connection validation.
|
8
12
|
|
9
13
|
app = PactBroker::App.new do | config |
|
10
14
|
# change these from their default values if desired
|
Binary file
|
@@ -13,7 +13,7 @@ module PactBroker
|
|
13
13
|
include Roar::Representer::JSON::HAL
|
14
14
|
include PactBroker::Api::PactBrokerUrls
|
15
15
|
|
16
|
-
collection :pacts, exec_context: :decorator, :class => PactBroker::
|
16
|
+
collection :pacts, exec_context: :decorator, :class => PactBroker::Domain::Pact, :extend => PactBroker::Api::Decorators::LatestPactDecorator
|
17
17
|
|
18
18
|
def pacts
|
19
19
|
represented.collect{ | pact | create_representable_pact(pact) }
|
@@ -13,7 +13,7 @@ module PactBroker
|
|
13
13
|
|
14
14
|
property :name
|
15
15
|
property :repository_url
|
16
|
-
property :version, :class => "PactBroker::
|
16
|
+
property :version, :class => "PactBroker::Domain::Version", :extend => PactBroker::Api::Decorators::VersionRepresenter, :embedded => true
|
17
17
|
|
18
18
|
link :self do | options |
|
19
19
|
pacticipant_url(options[:base_url], represented)
|
@@ -30,7 +30,7 @@ module PactBroker
|
|
30
30
|
|
31
31
|
class PacticipantCollectionRepresenter < BaseDecorator
|
32
32
|
|
33
|
-
collection :pacticipants, exec_context: :decorator, :class => PactBroker::
|
33
|
+
collection :pacticipants, exec_context: :decorator, :class => PactBroker::Domain::Pacticipant, :extend => PactBroker::Api::Decorators::PacticipantRepresenter
|
34
34
|
|
35
35
|
def pacticipants
|
36
36
|
represented
|
@@ -13,7 +13,7 @@ module PactBroker
|
|
13
13
|
property :name
|
14
14
|
property :repository_url, as: :repositoryUrl
|
15
15
|
|
16
|
-
property :latest_version, as: :'latest-version', :class => PactBroker::
|
16
|
+
property :latest_version, as: :'latest-version', :class => PactBroker::Domain::Version, :extend => PactBroker::Api::Decorators::VersionRepresenter, :embedded => true, writeable: false
|
17
17
|
|
18
18
|
include Timestamps
|
19
19
|
|
@@ -11,7 +11,7 @@ module PactBroker
|
|
11
11
|
|
12
12
|
def initialize pacts
|
13
13
|
@pacts = pacts
|
14
|
-
@relationships = pacts.collect{|pact| PactBroker::
|
14
|
+
@relationships = pacts.collect{|pact| PactBroker::Domain::Relationship.new(pact.consumer,pact.provider)}
|
15
15
|
end
|
16
16
|
|
17
17
|
def to_csv
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require_relative 'base_decorator'
|
2
2
|
require 'pact_broker/api/decorators/webhook_request_decorator'
|
3
3
|
require 'pact_broker/api/decorators/timestamps'
|
4
|
-
require 'pact_broker/
|
4
|
+
require 'pact_broker/domain/webhook_request'
|
5
5
|
require 'pact_broker/api/decorators/basic_pacticipant_decorator'
|
6
6
|
|
7
7
|
module PactBroker
|
@@ -9,7 +9,7 @@ module PactBroker
|
|
9
9
|
module Decorators
|
10
10
|
class WebhookDecorator < BaseDecorator
|
11
11
|
|
12
|
-
property :request, :class => PactBroker::
|
12
|
+
property :request, :class => PactBroker::Domain::WebhookRequest, :extend => WebhookRequestDecorator
|
13
13
|
|
14
14
|
include Timestamps
|
15
15
|
|
@@ -24,7 +24,7 @@ module PactBroker
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def allowed_methods
|
27
|
-
["GET", "PUT"]
|
27
|
+
["GET", "PUT", "DELETE"]
|
28
28
|
end
|
29
29
|
|
30
30
|
def malformed_request?
|
@@ -52,6 +52,13 @@ module PactBroker
|
|
52
52
|
PactBroker::Api::Decorators::PactDecorator.new(pact).to_json(base_url: base_url)
|
53
53
|
end
|
54
54
|
|
55
|
+
def delete_resource
|
56
|
+
pact_service.delete(pact_params)
|
57
|
+
true
|
58
|
+
end
|
59
|
+
|
60
|
+
private
|
61
|
+
|
55
62
|
def pact
|
56
63
|
@pact ||= pact_service.find_pact(pact_params)
|
57
64
|
end
|
@@ -66,7 +66,7 @@ module PactBroker
|
|
66
66
|
end
|
67
67
|
|
68
68
|
def webhook
|
69
|
-
@webhook ||= Decorators::WebhookDecorator.new(PactBroker::
|
69
|
+
@webhook ||= Decorators::WebhookDecorator.new(PactBroker::Domain::Webhook.new).from_json(request_body)
|
70
70
|
end
|
71
71
|
|
72
72
|
def next_uuid
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'pact_broker/api/resources/base_resource'
|
2
2
|
require 'pact_broker/api/decorators/pacticipant_decorator'
|
3
|
-
require 'pact_broker/
|
3
|
+
require 'pact_broker/domain/pacticipant'
|
4
4
|
|
5
5
|
module PactBroker
|
6
6
|
module Api
|
@@ -53,7 +53,7 @@ module PactBroker
|
|
53
53
|
end
|
54
54
|
|
55
55
|
def new_model
|
56
|
-
@new_model ||= decorator_for(PactBroker::
|
56
|
+
@new_model ||= decorator_for(PactBroker::Domain::Pacticipant.new).from_json(request.body.to_s)
|
57
57
|
end
|
58
58
|
|
59
59
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'sequel'
|
2
|
+
require 'pact_broker/messages'
|
3
|
+
|
4
|
+
module PactBroker
|
5
|
+
module DB
|
6
|
+
|
7
|
+
class ConnectionConfigurationError < StandardError; end
|
8
|
+
|
9
|
+
class ValidateEncoding
|
10
|
+
|
11
|
+
extend PactBroker::Messages
|
12
|
+
|
13
|
+
def self.call connection
|
14
|
+
encoding = connection.opts[:encoding] || connection.opts['encoding']
|
15
|
+
unless encoding =~ /utf\-?8/i
|
16
|
+
raise ConnectionConfigurationError.new(message('errors.validation.connection_encoding_not_utf8', encoding: encoding.inspect))
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -7,4 +7,6 @@ Participants are created automatically when a pact is published to the pact brok
|
|
7
7
|
|
8
8
|
|
9
9
|
### Deleting pacticipants
|
10
|
-
Deleting a pacticipant will delete all associated pacts, versions, tags and webhooks. To delete a pacticipant, send a DELETE request to the relevant pacticipant URL via the HAL browser.
|
10
|
+
Deleting a pacticipant will delete all associated pacts, versions, tags and webhooks. To delete a pacticipant, send a DELETE request to the relevant pacticipant URL via the HAL browser or any other HTTP client.
|
11
|
+
|
12
|
+
$ curl -X DELETE http://pact-broker/pacticipants/My%20Consumer
|
@@ -1,11 +1,11 @@
|
|
1
1
|
require 'versionomy'
|
2
2
|
|
3
3
|
module PactBroker
|
4
|
-
module
|
4
|
+
module Domain
|
5
5
|
class OrderVersions
|
6
6
|
|
7
7
|
def self.call pacticipant_id
|
8
|
-
orderable_versions = PactBroker::
|
8
|
+
orderable_versions = PactBroker::Domain::Version.where(:pacticipant_id => pacticipant_id).all.collect{| version | OrderableVersion.new(version) }
|
9
9
|
orderable_versions.sort.each_with_index{ | version, i | version.update_model(i) }
|
10
10
|
end
|
11
11
|
|