soapy_cake 1.10.0 → 1.10.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e449eedeaa5cdce80c84426b85054ebc48d19f14
4
- data.tar.gz: e44a87372c2030c0971b36c41713b7b78d865395
3
+ metadata.gz: bd7f28046b9e639c95ee20d72a246a4c82e60b9b
4
+ data.tar.gz: 36e406d3aa3c8d08120bc37778f0497b5df82c57
5
5
  SHA512:
6
- metadata.gz: ed74f8a1fc307b5cb32dfee2a8c5c692118ac4338d7003791c4cff3c96e0288cc885eb7739fea8c7f8f91e9189a735c69b6b258830bb2bad853dcebbadf82dbd
7
- data.tar.gz: 41137d677751139b8393d4e12abdc317e8e52c0aa806ffcb344c5cf4522f0ed362b528fc9c8511c14f3ab3e93ac9616854ec824f6d3034c43526a6697dfa65f2
6
+ metadata.gz: 7cc24e2507e40d571b4ad10d300e5662e55fd780fecf80caba7a1a96ab4cbceb3a5f345fa0f37200582d38c81b0e48be37ae63af7595bfdb43b0cbecb5a69414
7
+ data.tar.gz: cbd21bed265871e15e7c696d4d8549d8122e397133a1dd645c001a0173aff06b2984d6d6adac776eb606501652dad1be189b484781c6c742581b0bdb8ef9657c
data/README.md CHANGED
@@ -51,11 +51,3 @@ at [api_versions.yml](api_versions.yml).
51
51
  3. Commit your changes (`git commit -am 'Add some feature'`)
52
52
  4. Push to the branch (`git push origin my-new-feature`)
53
53
  5. Create a new Pull Request
54
-
55
- ## Actual Soapy Cakes
56
-
57
- If you are looking for actual soap cakes...
58
-
59
- ![Soapy Cake](http://soapycakes.co/wp-content/uploads/2012/05/blogpics17-310x205.jpg)
60
-
61
- you should head to [soapycakes.co](http://soapycakes.co).
@@ -167,13 +167,20 @@ module SoapyCake
167
167
  def apply_tag_opts!(opts)
168
168
  return unless opts[:tags]
169
169
 
170
- if opts[:tags].to_s == ''
171
- opts[:tags_modification_type] = 'remove_all'
172
- opts[:tags] = ''
173
- else
174
- opts[:tags_modification_type] = opts[:offer_id] ? 'add' : 'replace'
175
- opts[:tags] = Array(opts[:tags]).join(',')
176
- end
170
+ apply_tag_modification_type!(opts)
171
+
172
+ opts[:tags] = Array(opts[:tags]).join(',')
173
+ end
174
+
175
+ def apply_tag_modification_type!(opts)
176
+ opts[:tags_modification_type] =
177
+ if opts[:tags].to_s == ''
178
+ 'remove_all'
179
+ elsif opts.delete(:tags_replace) && opts[:offer_id] != 0
180
+ 'replace'
181
+ else
182
+ 'add'
183
+ end
177
184
  end
178
185
 
179
186
  def default_offer_options
@@ -1,3 +1,3 @@
1
1
  module SoapyCake
2
- VERSION = '1.10.0'
2
+ VERSION = '1.10.1'
3
3
  end
@@ -0,0 +1,82 @@
1
+ RSpec.describe SoapyCake::AdminAddedit do
2
+ before do
3
+ allow_any_instance_of(SoapyCake::Client).to receive(:run).and_return({})
4
+ end
5
+
6
+ describe '#edit_offer' do
7
+ let(:offer_params) do
8
+ {
9
+ offer_id: 12,
10
+ advertiser_id: 1,
11
+ vertical_id: 1,
12
+ postback_url_ms_delay: 0,
13
+ offer_contract_hidden: true,
14
+ price_format_id: :cpa,
15
+ received: 0,
16
+ received_percentage: 0,
17
+ payout: 0,
18
+ tags: 'new-tag'
19
+ }
20
+ end
21
+
22
+ it 'keeps existing tags' do
23
+ expect(SoapyCake::Request).to receive(:new)
24
+ .with(:admin, :addedit, :offer,
25
+ hash_including(tags: 'new-tag', tags_modification_type: 'add'))
26
+
27
+ subject.edit_offer(offer_params)
28
+ end
29
+
30
+ it 'allows replacing tags' do
31
+ expect(SoapyCake::Request).to receive(:new)
32
+ .with(:admin, :addedit, :offer,
33
+ hash_including(tags: 'new-tag', tags_modification_type: 'replace'))
34
+
35
+ subject.edit_offer(offer_params.merge(tags_replace: true))
36
+ end
37
+ end
38
+
39
+ describe '#add_offer' do
40
+ let(:offer_params) do
41
+ {
42
+ offer_name: 'Test',
43
+ hidden: true,
44
+ offer_status_id: :public,
45
+ offer_type_id: :third_party,
46
+ currency_id: :eur,
47
+ ssl: true,
48
+ click_cookie_days: 1,
49
+ impression_cookie_days: 1,
50
+ redirect_404: true,
51
+ enable_view_thru_conversions: true,
52
+ click_trumps_impression: true,
53
+ disable_click_deduplication: false,
54
+ last_touch: true,
55
+ enable_transaction_id_deduplication: true,
56
+ postbacks_only: false,
57
+ fire_global_pixel: true,
58
+ fire_pixel_on_nonpaid_conversions: false,
59
+ offer_link: 'http://www.ree.com',
60
+ thankyou_link: 'http://www.www.ww',
61
+ from_lines: '',
62
+ subject_lines: '',
63
+ advertiser_id: 1,
64
+ vertical_id: 1,
65
+ postback_url_ms_delay: 0,
66
+ offer_contract_hidden: false,
67
+ price_format_id: :cpa,
68
+ received: 4,
69
+ received_percentage: false,
70
+ payout: 4
71
+ }
72
+ end
73
+
74
+ it 'always adds on creation' do
75
+ expect(SoapyCake::Request).to receive(:new)
76
+ .with(:admin, :addedit, :offer,
77
+ hash_including(tags: 'tag', tags_modification_type: 'add'))
78
+
79
+ subject.add_offer(offer_params.merge(tags: 'tag', tags_replace: true))
80
+ end
81
+ end
82
+ end
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: 1.10.0
4
+ version: 1.10.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: 2015-06-23 00:00:00.000000000 Z
11
+ date: 2015-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -215,6 +215,7 @@ files:
215
215
  - spec/integration/soapy_cake/admin_addedit_spec.rb
216
216
  - spec/integration/soapy_cake/admin_spec.rb
217
217
  - spec/integration/soapy_cake/admin_track_spec.rb
218
+ - spec/lib/soapy_cake/admin_addedit_spec.rb
218
219
  - spec/lib/soapy_cake/admin_spec.rb
219
220
  - spec/lib/soapy_cake/admin_track_spec.rb
220
221
  - spec/lib/soapy_cake/affiliate_spec.rb
@@ -268,6 +269,7 @@ test_files:
268
269
  - spec/integration/soapy_cake/admin_addedit_spec.rb
269
270
  - spec/integration/soapy_cake/admin_spec.rb
270
271
  - spec/integration/soapy_cake/admin_track_spec.rb
272
+ - spec/lib/soapy_cake/admin_addedit_spec.rb
271
273
  - spec/lib/soapy_cake/admin_spec.rb
272
274
  - spec/lib/soapy_cake/admin_track_spec.rb
273
275
  - spec/lib/soapy_cake/affiliate_spec.rb