soapy_cake 2.1.0 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop_todo.yml +16 -0
  3. data/Gemfile +2 -1
  4. data/circle.yml +2 -0
  5. data/lib/soapy_cake.rb +3 -0
  6. data/lib/soapy_cake/admin.rb +2 -2
  7. data/lib/soapy_cake/admin_addedit.rb +5 -50
  8. data/lib/soapy_cake/campaigns.rb +104 -0
  9. data/lib/soapy_cake/client.rb +5 -5
  10. data/lib/soapy_cake/helper.rb +14 -9
  11. data/lib/soapy_cake/modification_type.rb +45 -0
  12. data/lib/soapy_cake/version.rb +1 -1
  13. data/spec/fixtures/vcr_cassettes/SoapyCake_AdminAddedit/campaigns/edits_a_campaign.yml +18 -5
  14. data/spec/fixtures/vcr_cassettes/SoapyCake_Campaigns/_create/creates_campaigns.yml +60 -0
  15. data/spec/fixtures/vcr_cassettes/SoapyCake_Campaigns/_create/raises_an_error_if_the_creation_was_unsuccessful.yml +60 -0
  16. data/spec/fixtures/vcr_cassettes/SoapyCake_Campaigns/_get/gets_campaigns.yml +1205 -0
  17. data/spec/fixtures/vcr_cassettes/SoapyCake_Campaigns/_patch/different_pre-existing_values/does_not_change_anything_unintentionally_attribute_set_0_.yml +380 -0
  18. data/spec/fixtures/vcr_cassettes/SoapyCake_Campaigns/_patch/different_pre-existing_values/does_not_change_anything_unintentionally_attribute_set_1_.yml +383 -0
  19. data/spec/fixtures/vcr_cassettes/SoapyCake_Campaigns/_patch/updates_a_campaign.yml +454 -0
  20. data/spec/fixtures/vcr_cassettes/SoapyCake_Campaigns/_update/raises_an_error_if_the_update_was_unsuccessful.yml +82 -0
  21. data/spec/fixtures/vcr_cassettes/SoapyCake_Campaigns/_update/updates_campaigns.yml +82 -0
  22. data/spec/integration/soapy_cake/admin_addedit_spec.rb +0 -31
  23. data/spec/integration/soapy_cake/campaigns_spec.rb +175 -0
  24. data/spec/lib/soapy_cake/admin_spec.rb +0 -1
  25. data/spec/lib/soapy_cake/campaigns_spec.rb +127 -0
  26. data/spec/lib/soapy_cake/modification_type_spec.rb +59 -0
  27. data/spec/spec_helper.rb +3 -3
  28. metadata +27 -2
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+ RSpec.describe SoapyCake::ModificationType do
3
+ subject(:output_opts) do
4
+ described_class.new(:foo, :foo_mod_type, 'bar').options(input_opts)
5
+ end
6
+
7
+ context 'no related params are provided' do
8
+ let(:input_opts) { {} }
9
+
10
+ it 'returns options for removing the set value' do
11
+ expect(output_opts).to eq(foo: 'bar', foo_mod_type: 'remove')
12
+ end
13
+ end
14
+
15
+ context 'a value is provided' do
16
+ let(:input_opts) { { foo: 'ping' } }
17
+
18
+ it 'returns options for changing the value' do
19
+ expect(output_opts).to eq(foo: 'ping', foo_mod_type: 'change')
20
+ end
21
+ end
22
+
23
+ context 'a modification type of "change" is provided' do
24
+ let(:input_opts) { { foo_mod_type: 'change' } }
25
+
26
+ it 'raises an error' do
27
+ expect do
28
+ output_opts
29
+ end.to raise_error(
30
+ described_class::InvalidInput,
31
+ "`foo_mod_type` was 'change', but no `foo` was provided to change it to"
32
+ )
33
+ end
34
+ end
35
+
36
+ context 'a modification type of "remove" is provided' do
37
+ let(:input_opts) { { foo_mod_type: 'remove' } }
38
+
39
+ it 'returns options for removing the value' do
40
+ expect(output_opts).to eq(foo: 'bar', foo_mod_type: 'remove')
41
+ end
42
+ end
43
+
44
+ context 'a modification type of "do_not_change" is provided' do
45
+ let(:input_opts) { { foo_mod_type: 'do_not_change' } }
46
+
47
+ it 'returns options for not changing the value' do
48
+ expect(output_opts).to eq(foo: 'bar', foo_mod_type: 'do_not_change')
49
+ end
50
+ end
51
+
52
+ context 'a value and modification type are provided' do
53
+ let(:input_opts) { { foo: 'ping', foo_mod_type: 'pong' } }
54
+
55
+ it 'returns the options passed in' do
56
+ expect(output_opts).to eq(foo: 'ping', foo_mod_type: 'pong')
57
+ end
58
+ end
59
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
- if ENV['CODECLIMATE_REPO_TOKEN']
3
- require 'codeclimate-test-reporter'
4
- CodeClimate::TestReporter.start
2
+ require 'simplecov'
3
+ SimpleCov.start do
4
+ add_filter '/spec/'
5
5
  end
6
6
  require 'bundler/setup'
7
7
  Bundler.require(:default, :development)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: soapy_cake
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ad2games GmbH
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-26 00:00:00.000000000 Z
11
+ date: 2017-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -173,6 +173,7 @@ extra_rdoc_files: []
173
173
  files:
174
174
  - ".gitignore"
175
175
  - ".rspec"
176
+ - ".rubocop_todo.yml"
176
177
  - ".ruby-version"
177
178
  - Gemfile
178
179
  - LICENSE.txt
@@ -186,10 +187,12 @@ files:
186
187
  - lib/soapy_cake/admin_batched.rb
187
188
  - lib/soapy_cake/admin_track.rb
188
189
  - lib/soapy_cake/affiliate.rb
190
+ - lib/soapy_cake/campaigns.rb
189
191
  - lib/soapy_cake/client.rb
190
192
  - lib/soapy_cake/const.rb
191
193
  - lib/soapy_cake/error.rb
192
194
  - lib/soapy_cake/helper.rb
195
+ - lib/soapy_cake/modification_type.rb
193
196
  - lib/soapy_cake/request.rb
194
197
  - lib/soapy_cake/response.rb
195
198
  - lib/soapy_cake/response_value.rb
@@ -223,14 +226,25 @@ files:
223
226
  - spec/fixtures/vcr_cassettes/SoapyCake_AdminAddedit/offers/updates_an_offer.yml
224
227
  - spec/fixtures/vcr_cassettes/SoapyCake_AdminTrack/_mass_conversion_insert/inserts_conversions.yml
225
228
  - spec/fixtures/vcr_cassettes/SoapyCake_AdminTrack/_update_conversion/updates_a_conversion.yml
229
+ - spec/fixtures/vcr_cassettes/SoapyCake_Campaigns/_create/creates_campaigns.yml
230
+ - spec/fixtures/vcr_cassettes/SoapyCake_Campaigns/_create/raises_an_error_if_the_creation_was_unsuccessful.yml
231
+ - spec/fixtures/vcr_cassettes/SoapyCake_Campaigns/_get/gets_campaigns.yml
232
+ - spec/fixtures/vcr_cassettes/SoapyCake_Campaigns/_patch/different_pre-existing_values/does_not_change_anything_unintentionally_attribute_set_0_.yml
233
+ - spec/fixtures/vcr_cassettes/SoapyCake_Campaigns/_patch/different_pre-existing_values/does_not_change_anything_unintentionally_attribute_set_1_.yml
234
+ - spec/fixtures/vcr_cassettes/SoapyCake_Campaigns/_patch/updates_a_campaign.yml
235
+ - spec/fixtures/vcr_cassettes/SoapyCake_Campaigns/_update/raises_an_error_if_the_update_was_unsuccessful.yml
236
+ - spec/fixtures/vcr_cassettes/SoapyCake_Campaigns/_update/updates_campaigns.yml
226
237
  - spec/integration/soapy_cake/admin_addedit_spec.rb
227
238
  - spec/integration/soapy_cake/admin_spec.rb
228
239
  - spec/integration/soapy_cake/admin_track_spec.rb
240
+ - spec/integration/soapy_cake/campaigns_spec.rb
229
241
  - spec/lib/soapy_cake/admin_addedit_spec.rb
230
242
  - spec/lib/soapy_cake/admin_batched_spec.rb
231
243
  - spec/lib/soapy_cake/admin_spec.rb
232
244
  - spec/lib/soapy_cake/admin_track_spec.rb
233
245
  - spec/lib/soapy_cake/affiliate_spec.rb
246
+ - spec/lib/soapy_cake/campaigns_spec.rb
247
+ - spec/lib/soapy_cake/modification_type_spec.rb
234
248
  - spec/lib/soapy_cake/request_spec.rb
235
249
  - spec/lib/soapy_cake/response_spec.rb
236
250
  - spec/lib/soapy_cake/response_value_spec.rb
@@ -289,14 +303,25 @@ test_files:
289
303
  - spec/fixtures/vcr_cassettes/SoapyCake_AdminAddedit/offers/updates_an_offer.yml
290
304
  - spec/fixtures/vcr_cassettes/SoapyCake_AdminTrack/_mass_conversion_insert/inserts_conversions.yml
291
305
  - spec/fixtures/vcr_cassettes/SoapyCake_AdminTrack/_update_conversion/updates_a_conversion.yml
306
+ - spec/fixtures/vcr_cassettes/SoapyCake_Campaigns/_create/creates_campaigns.yml
307
+ - spec/fixtures/vcr_cassettes/SoapyCake_Campaigns/_create/raises_an_error_if_the_creation_was_unsuccessful.yml
308
+ - spec/fixtures/vcr_cassettes/SoapyCake_Campaigns/_get/gets_campaigns.yml
309
+ - spec/fixtures/vcr_cassettes/SoapyCake_Campaigns/_patch/different_pre-existing_values/does_not_change_anything_unintentionally_attribute_set_0_.yml
310
+ - spec/fixtures/vcr_cassettes/SoapyCake_Campaigns/_patch/different_pre-existing_values/does_not_change_anything_unintentionally_attribute_set_1_.yml
311
+ - spec/fixtures/vcr_cassettes/SoapyCake_Campaigns/_patch/updates_a_campaign.yml
312
+ - spec/fixtures/vcr_cassettes/SoapyCake_Campaigns/_update/raises_an_error_if_the_update_was_unsuccessful.yml
313
+ - spec/fixtures/vcr_cassettes/SoapyCake_Campaigns/_update/updates_campaigns.yml
292
314
  - spec/integration/soapy_cake/admin_addedit_spec.rb
293
315
  - spec/integration/soapy_cake/admin_spec.rb
294
316
  - spec/integration/soapy_cake/admin_track_spec.rb
317
+ - spec/integration/soapy_cake/campaigns_spec.rb
295
318
  - spec/lib/soapy_cake/admin_addedit_spec.rb
296
319
  - spec/lib/soapy_cake/admin_batched_spec.rb
297
320
  - spec/lib/soapy_cake/admin_spec.rb
298
321
  - spec/lib/soapy_cake/admin_track_spec.rb
299
322
  - spec/lib/soapy_cake/affiliate_spec.rb
323
+ - spec/lib/soapy_cake/campaigns_spec.rb
324
+ - spec/lib/soapy_cake/modification_type_spec.rb
300
325
  - spec/lib/soapy_cake/request_spec.rb
301
326
  - spec/lib/soapy_cake/response_spec.rb
302
327
  - spec/lib/soapy_cake/response_value_spec.rb