Skip to content

Commit

Permalink
Merge branch 'master' into travis-ci-deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
radicm committed Apr 4, 2019
2 parents 7d77af0 + 9a8954e commit a7e6c23
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ A good reference on how to use this wrapper are also the Rspecs.
* `/zones/:zone_id/available_rate_plans`
* `/zones/:zone_id/dns_records` GET, POST
* `/zones/:zone_id/dns_records/:record_id` GET, DELETE (PUT not implemented)
* `/zones/:zone_id/purge_cache` DELETE
* `/zones/:zone_id/purge_cache` POST
* `/zones/:zone_id/railguns` GET
* `/zones/:zone_id/railguns/:railgun_id` GET
* `/zones/:zone_id/railguns/:railgun_id/diagnose` GET, PATCH
Expand Down
2 changes: 1 addition & 1 deletion cloudflair.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
spec.add_runtime_dependency 'dry-configurable', '~> 0.1'
spec.add_runtime_dependency 'faraday-detailed_logger'

spec.add_development_dependency 'bundler', '~> 1.12'
spec.add_development_dependency 'bundler', '~> 2.0.0'
spec.add_development_dependency 'rake', '~> 12.0'
spec.add_development_dependency 'rspec', '~> 3.0'
spec.add_development_dependency 'dotenv', '~> 2.1'
Expand Down
4 changes: 2 additions & 2 deletions lib/cloudflair/api/zone/purge_cache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def initialize(zone_id)
##
# @param purge_everything must be set to true
def everything(purge_everything)
resp = connection.delete(path) { |req| req.body = { purge_everything: purge_everything } }
resp = connection.post(path) { |req| req.body = { purge_everything: purge_everything } }
response resp
self
end
Expand All @@ -23,7 +23,7 @@ def everything(purge_everything)
def selective(cache_identifier = {})
return self if cache_identifier.nil? || cache_identifier.empty?

resp = connection.delete(path) { |req| req.body = cache_identifier }
resp = connection.post(path) { |req| req.body = cache_identifier }
response resp
self
end
Expand Down
12 changes: 6 additions & 6 deletions spec/cloudflair/api/zone/purge_cache_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@

describe '#everything' do
before do
faraday_stubs.delete(url) do |env|
faraday_stubs.post(url) do |env|
expect(env.body).to eq(purge_everything: true)

[200, { content_type: 'application/json' }, response_json]
end
end

it 'deletes all files' do
expect(faraday).to receive(:delete).and_call_original
expect(faraday).to receive(:post).and_call_original

expect(subject.everything(true)).to be subject
end

it 'is repeatedly executed' do
expect(faraday).to receive(:delete).twice.and_call_original
expect(faraday).to receive(:post).twice.and_call_original

expect(subject.everything(true)).to be subject
expect(subject.everything(true)).to be subject
Expand All @@ -46,21 +46,21 @@
let(:selective_list) { { tags: ['hello'], files: ['https://foo.bar/index.html'] } }

before do
faraday_stubs.delete(url) do |env|
faraday_stubs.post(url) do |env|
expect(env.body).to eq(selective_list)

[200, { content_type: 'application/json' }, response_json]
end
end

it 'deletes all files' do
expect(faraday).to receive(:delete).and_call_original
expect(faraday).to receive(:post).and_call_original

expect(subject.selective(selective_list)).to be subject
end

it 'is repeatedly executed' do
expect(faraday).to receive(:delete).twice.and_call_original
expect(faraday).to receive(:post).twice.and_call_original

expect(subject.selective(selective_list)).to be subject
expect(subject.selective(selective_list)).to be subject
Expand Down

0 comments on commit a7e6c23

Please sign in to comment.