Skip to content

Commit

Permalink
Merge pull request #1048 from alphagov/send-update-type-with-put-content
Browse files Browse the repository at this point in the history
Send update_type with put content
  • Loading branch information
emmabeynon authored Jul 25, 2017
2 parents 9d91d61 + 1be6075 commit d1d4649
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ gem 'uglifier', '>= 1.3.0'
gem 'unicorn', '~> 4.9.0'

# GDS managed dependencies
gem "gds-api-adapters", "41.5.0"
gem "gds-api-adapters", "47.2"
gem 'gds-sso', '13.2.0'
gem "govspeak", "~> 5.0.1"
gem 'govuk_admin_template', '~> 4.4.1'
Expand Down
10 changes: 5 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ GEM
multipart-post (>= 1.2, < 3)
foreman (0.84.0)
thor (~> 0.19.1)
gds-api-adapters (41.5.0)
gds-api-adapters (47.2.0)
link_header
lrucache (~> 0.1.1)
null_logger
Expand Down Expand Up @@ -230,7 +230,7 @@ GEM
pry (>= 0.10.4)
pundit (1.1.0)
activesupport (>= 3.0.0)
rack (2.0.1)
rack (2.0.3)
rack-cache (1.7.0)
rack (>= 0.4)
rack-protection (1.5.3)
Expand Down Expand Up @@ -271,7 +271,7 @@ GEM
redis-namespace (1.5.3)
redis (~> 3.0, >= 3.0.4)
request_store (1.3.2)
rest-client (2.0.1)
rest-client (2.0.2)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
Expand Down Expand Up @@ -385,7 +385,7 @@ DEPENDENCIES
database_cleaner
factory_girl
foreman
gds-api-adapters (= 41.5.0)
gds-api-adapters (= 47.2)
gds-sso (= 13.2.0)
govspeak (~> 5.0.1)
govuk-content-schema-test-helpers
Expand Down Expand Up @@ -415,4 +415,4 @@ DEPENDENCIES
webmock

BUNDLED WITH
1.14.5
1.15.1
3 changes: 1 addition & 2 deletions app/services/document_publisher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ def self.publish(document)
document.update_type = 'major'
document.save
end

Services.publishing_api.publish(document.content_id, document.update_type)
Services.publishing_api.publish(document.content_id)

published_document = document.class.find(document.content_id)
indexable_document = SearchPresenter.new(published_document)
Expand Down
4 changes: 2 additions & 2 deletions lib/publishing_api_finder_publisher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def export_finder(finder)

Services.publishing_api.put_content(finder_payload.content_id, finder_payload.to_json)
Services.publishing_api.patch_links(finder_payload.content_id, links_payload.to_json)
Services.publishing_api.publish(finder_payload.content_id, "major")
Services.publishing_api.publish(finder_payload.content_id)
end

def export_signup(finder)
Expand All @@ -64,6 +64,6 @@ def export_signup(finder)

Services.publishing_api.put_content(signup_payload.content_id, signup_payload.to_json)
Services.publishing_api.patch_links(signup_payload.content_id, links_payload.to_json)
Services.publishing_api.publish(signup_payload.content_id, "major")
Services.publishing_api.publish(signup_payload.content_id)
end
end
14 changes: 7 additions & 7 deletions spec/lib/publishing_api_finder_publisher_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,23 +64,23 @@ def make_finder(base_path, overrides = {})
expect(publishing_api).to receive(:patch_links)
.with(finders[0][:file]["content_id"], anything)
expect(publishing_api).to receive(:publish)
.with(finders[0][:file]["content_id"], "major")
.with(finders[0][:file]["content_id"])

# This should be validated against an email-signup schema if one gets created
expect(publishing_api).to receive(:put_content)
.with(finders[0][:file]["signup_content_id"], anything)
expect(publishing_api).to receive(:patch_links)
.with(finders[0][:file]["signup_content_id"], anything)
expect(publishing_api).to receive(:publish)
.with(finders[0][:file]["signup_content_id"], "major")
.with(finders[0][:file]["signup_content_id"])


expect(publishing_api).to receive(:put_content)
.with(finders[1][:file]["content_id"], be_valid_against_schema("finder"))
expect(publishing_api).to receive(:patch_links)
.with(finders[1][:file]["content_id"], anything)
expect(publishing_api).to receive(:publish)
.with(finders[1][:file]["content_id"], "major")
.with(finders[1][:file]["content_id"])

PublishingApiFinderPublisher.new(finders, logger: test_logger).call
end
Expand All @@ -107,7 +107,7 @@ def make_finder(base_path, overrides = {})
expect(publishing_api).to receive(:patch_links)
.with(finders[0][:file]["content_id"], anything)
expect(publishing_api).to receive(:publish)
.with(finders[0][:file]["content_id"], "major")
.with(finders[0][:file]["content_id"])

PublishingApiFinderPublisher.new(finders, logger: test_logger).call
end
Expand All @@ -134,7 +134,7 @@ def make_finder(base_path, overrides = {})
expect(publishing_api).to receive(:patch_links)
.with(content_id, anything)
expect(publishing_api).to receive(:publish)
.with(content_id, "major")
.with(content_id)

PublishingApiFinderPublisher.new(finders, logger: test_logger).call
end
Expand Down Expand Up @@ -166,7 +166,7 @@ def make_finder(base_path, overrides = {})
expect(publishing_api).to receive(:patch_links)
.with(content_id, anything)
expect(publishing_api).to receive(:publish)
.with(content_id, "major")
.with(content_id)

PublishingApiFinderPublisher.new(finders, logger: test_logger).call
end
Expand All @@ -179,7 +179,7 @@ def make_finder(base_path, overrides = {})
expect(publishing_api).not_to receive(:patch_links)
.with(content_id, anything)
expect(publishing_api).not_to receive(:publish)
.with(content_id, "major")
.with(content_id)

PublishingApiFinderPublisher.new(finders, logger: test_logger).call
end
Expand Down

0 comments on commit d1d4649

Please sign in to comment.