soapy_cake 2.1.3 → 2.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -1
  3. data/Rakefile +1 -0
  4. data/api.yml +1 -1
  5. data/lib/soapy_cake.rb +2 -1
  6. data/lib/soapy_cake/admin.rb +1 -0
  7. data/lib/soapy_cake/admin_addedit.rb +1 -0
  8. data/lib/soapy_cake/admin_batched.rb +1 -0
  9. data/lib/soapy_cake/admin_track.rb +1 -0
  10. data/lib/soapy_cake/affiliate.rb +1 -0
  11. data/lib/soapy_cake/campaigns.rb +2 -1
  12. data/lib/soapy_cake/client.rb +13 -0
  13. data/lib/soapy_cake/const.rb +1 -0
  14. data/lib/soapy_cake/error.rb +1 -0
  15. data/lib/soapy_cake/helper.rb +1 -0
  16. data/lib/soapy_cake/modification_type.rb +1 -0
  17. data/lib/soapy_cake/request.rb +1 -0
  18. data/lib/soapy_cake/response.rb +1 -0
  19. data/lib/soapy_cake/response_value.rb +1 -0
  20. data/lib/soapy_cake/time_converter.rb +1 -0
  21. data/lib/soapy_cake/version.rb +2 -1
  22. data/soapy_cake.gemspec +1 -0
  23. data/spec/fixtures/vcr_cassettes/SoapyCake_Admin/returns_a_clicks_report_with_a_defined_time_range.yml +41 -26
  24. data/spec/integration/soapy_cake/admin_addedit_spec.rb +1 -0
  25. data/spec/integration/soapy_cake/admin_spec.rb +6 -4
  26. data/spec/integration/soapy_cake/admin_track_spec.rb +1 -0
  27. data/spec/integration/soapy_cake/campaigns_spec.rb +1 -0
  28. data/spec/lib/soapy_cake/admin_addedit_spec.rb +1 -0
  29. data/spec/lib/soapy_cake/admin_batched_spec.rb +2 -0
  30. data/spec/lib/soapy_cake/admin_spec.rb +31 -0
  31. data/spec/lib/soapy_cake/admin_track_spec.rb +1 -0
  32. data/spec/lib/soapy_cake/affiliate_spec.rb +3 -0
  33. data/spec/lib/soapy_cake/campaigns_spec.rb +6 -5
  34. data/spec/lib/soapy_cake/modification_type_spec.rb +1 -0
  35. data/spec/lib/soapy_cake/request_spec.rb +1 -0
  36. data/spec/lib/soapy_cake/response_spec.rb +1 -0
  37. data/spec/lib/soapy_cake/response_value_spec.rb +1 -0
  38. data/spec/lib/soapy_cake/time_converter_spec.rb +1 -0
  39. data/spec/spec_helper.rb +1 -0
  40. data/spec/support/admin_method_example.rb +2 -0
  41. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a37f381f91ecea276b653c460ae2caaa092780aa
4
- data.tar.gz: f38754f61d72c837f36349d1db27f9b992c6fdf1
3
+ metadata.gz: 67f28d72d0e7ce5c2d37d3d138d0a8e2579b9696
4
+ data.tar.gz: 737fced76a4f046d011fd6e57817ff0c29f5d435
5
5
  SHA512:
6
- metadata.gz: 83fbab922c38a5ef3f02c431637b6e49c152a2e573edc05c609c7b482faf7e8dcde32510a68ec674ef143deaef373bade1c69129abdcf9781ede0ddcf2d29d04
7
- data.tar.gz: 61aa15d8fd949a4783941893910519771c268d66e572c74e5edb0c2d37c94e2bd46249012802d2366504352f0fb7d512dbd1c2ce521bfb2f8091bee958cc1191
6
+ metadata.gz: a418b18bb03685e298fedd73aee586fed6c7aa45a0989609b0892cbaf99ab15d2d4919a0a2f2fc0b1e049c66f387fee19ee8df1986ce4653adeac4b459e8c041
7
+ data.tar.gz: 2f31ae5c96fc4f9e101a9f5aca857f99d6777b278125a21a5ecd3e6016c4b48cc68cc453fb931247a174afa379b149f8e01b6fea1cb819b6625bf5565fd65806
data/Gemfile CHANGED
@@ -1,10 +1,11 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  source 'https://rubygems.org'
3
4
 
4
5
  gemspec
5
6
 
6
7
  group :development, :test do
8
+ gem 'codeclimate-test-reporter', require: false
7
9
  gem 'rubocop-ci', git: 'https://github.com/ad2games/rubocop-ci'
8
10
  gem 'simplecov'
9
- gem 'codeclimate-test-reporter', require: false
10
11
  end
data/Rakefile CHANGED
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'bundler/gem_tasks'
3
4
  require 'rspec/core/rake_task'
4
5
  require 'rubocop-ci'
data/api.yml CHANGED
@@ -77,7 +77,7 @@ versions:
77
77
  campaign_summary: 2
78
78
  creative_summary: 2
79
79
  caps: 4
80
- clicks: 7
80
+ clicks: 11
81
81
  conversion_changes: 10
82
82
  conversions: 11
83
83
  daily_summary_export: 1
data/lib/soapy_cake.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'yaml'
3
4
  require 'logger'
4
5
  require 'nokogiri'
@@ -27,6 +28,6 @@ require 'soapy_cake/modification_type'
27
28
  require 'soapy_cake/campaigns'
28
29
 
29
30
  module SoapyCake
30
- API_CONFIG = YAML.load(File.read(File.expand_path('../../api.yml', __FILE__)))
31
+ API_CONFIG = YAML.safe_load(File.read(File.expand_path('../../api.yml', __FILE__)))
31
32
  NET_TIMEOUT = 600
32
33
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module SoapyCake
3
4
  # rubocop:disable Metrics/ClassLength
4
5
  class Admin < Client
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module SoapyCake
3
4
  # rubocop:disable Metrics/ClassLength
4
5
  class AdminAddedit < Client
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module SoapyCake
3
4
  class AdminBatched
4
5
  ALLOWED_METHODS = %i(
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module SoapyCake
3
4
  class AdminTrack < Client
4
5
  include Helper
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module SoapyCake
3
4
  class Affiliate < Client
4
5
  def bills(opts = {})
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module SoapyCake
3
4
  class Campaigns
4
5
  include Helper
@@ -59,7 +60,7 @@ module SoapyCake
59
60
  .merge(
60
61
  affiliate_id: campaign.fetch(:affiliate).fetch(:affiliate_id),
61
62
  # Only present in production:
62
- display_link_type_id: campaign.dig(:link_display_type, :link_display_type_id) || 1,
63
+ display_link_type_id: campaign.dig(:display_link_type, :link_display_type_id) || 1,
63
64
  media_type_id: campaign.fetch(:media_type).fetch(:media_type_id),
64
65
  offer_contract_id: campaign.fetch(:offer_contract).fetch(:offer_contract_id),
65
66
  offer_id: campaign.fetch(:offer).fetch(:offer_id),
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'net/http'
3
4
 
4
5
  module SoapyCake
@@ -57,6 +58,16 @@ module SoapyCake
57
58
  @logger ||= opts[:logger] || (defined?(::Rails) && ::Rails.logger)
58
59
  end
59
60
 
61
+ def log_curl_command(request)
62
+ curl_headers = HEADERS.map { |k, v| "-H \"#{k}: #{v}\"" }.join(' ')
63
+ curl_body = request.xml
64
+ .tr("\n", '')
65
+ .gsub(/>\s*</, '><')
66
+ .sub(request.api_key, '{{{ INSERT API KEY }}}')
67
+
68
+ logger&.info("curl --data '#{curl_body}' #{curl_headers} https://#{domain}/#{request.path}")
69
+ end
70
+
60
71
  def response_body(request)
61
72
  request.opts[:response].presence || http_response(request)
62
73
  end
@@ -64,6 +75,8 @@ module SoapyCake
64
75
  def http_response(request)
65
76
  logger&.info("soapy_cake:request #{request}")
66
77
 
78
+ log_curl_command(request) if fetch_opt(:log_curl)
79
+
67
80
  http_request = Net::HTTP::Post.new(request.path, HEADERS)
68
81
  http_request.body = request.xml
69
82
  response = perform_http_request(http_request)
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module SoapyCake
3
4
  module Const
4
5
  # The ID mapping in the API docs is wrong, these values are taken from the UI.
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module SoapyCake
3
4
  class Error < RuntimeError; end
4
5
  class RequestFailed < Error; end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module SoapyCake
3
4
  module Helper
4
5
  def walk_tree(obj, key = nil, &block)
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module SoapyCake
3
4
  class ModificationType
4
5
  CHANGE = 'change'
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module SoapyCake
3
4
  class Request
4
5
  DATE_CLASSES = [Date, Time, DateTime, ActiveSupport::TimeWithZone].freeze
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module SoapyCake
3
4
  class Response
4
5
  include Helper
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module SoapyCake
3
4
  class ResponseValue
4
5
  attr_reader :key, :value
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module SoapyCake
3
4
  class TimeConverter
4
5
  def initialize(time_zone, time_offset = nil)
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module SoapyCake
3
- VERSION = '2.1.3'
4
+ VERSION = '2.1.4'
4
5
  end
data/soapy_cake.gemspec CHANGED
@@ -1,5 +1,6 @@
1
1
  # coding: utf-8
2
2
  # frozen_string_literal: true
3
+
3
4
  lib = File.expand_path('../lib', __FILE__)
4
5
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
6
  require 'soapy_cake/version'
@@ -2,18 +2,18 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: post
5
- uri: https://cake-partner-domain.com/api/7/reports.asmx
5
+ uri: https://cake-partner-domain.com/api/11/reports.asmx
6
6
  body:
7
7
  encoding: UTF-8
8
8
  string: |
9
9
  <?xml version="1.0"?>
10
- <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:cake="http://cakemarketing.com/api/7/">
10
+ <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:cake="http://cakemarketing.com/api/11/">
11
11
  <env:Header/>
12
12
  <env:Body>
13
13
  <cake:Clicks>
14
14
  <cake:api_key>cake-api-key</cake:api_key>
15
- <cake:start_date>2014-06-30T02:00:00</cake:start_date>
16
- <cake:end_date>2014-07-01T02:00:00</cake:end_date>
15
+ <cake:start_date>2017-05-31T02:00:00</cake:start_date>
16
+ <cake:end_date>2017-06-01T02:00:00</cake:end_date>
17
17
  <cake:row_limit>1</cake:row_limit>
18
18
  </cake:Clicks>
19
19
  </env:Body>
@@ -21,6 +21,12 @@ http_interactions:
21
21
  headers:
22
22
  Content-Type:
23
23
  - application/soap+xml;charset=UTF-8
24
+ Accept-Encoding:
25
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
26
+ Accept:
27
+ - "*/*"
28
+ User-Agent:
29
+ - Ruby
24
30
  response:
25
31
  status:
26
32
  code: 200
@@ -28,38 +34,47 @@ http_interactions:
28
34
  headers:
29
35
  Cache-Control:
30
36
  - private, max-age=0
37
+ Content-Length:
38
+ - '4034'
31
39
  Content-Type:
32
40
  - application/soap+xml; charset=utf-8
33
- Server:
34
- - Microsoft-IIS/8.0
41
+ Date:
42
+ - Tue, 27 Jun 2017 09:14:48 GMT
35
43
  X-Aspnet-Version:
36
44
  - 4.0.30319
37
45
  X-Powered-By:
38
46
  - ASP.NET
39
- Date:
40
- - Fri, 13 Feb 2015 14:29:42 GMT
41
- Content-Length:
42
- - '2151'
47
+ Connection:
48
+ - close
43
49
  body:
44
50
  encoding: UTF-8
45
51
  string: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
46
52
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><ClicksResponse
47
- xmlns="http://cakemarketing.com/api/7/"><ClicksResult><success>true</success><row_count>9</row_count><clicks><click><click_id>1275452</click_id><visitor_id>1208222</visitor_id><request_session_id>1303953</request_session_id><click_date>2014-06-30T19:31:35.067</click_date><affiliate><affiliate_id
48
- xmlns="API:id_name_store">-1</affiliate_id><affiliate_name xmlns="API:id_name_store">ad2games
49
- GmbH</affiliate_name></affiliate><advertiser><advertiser_id xmlns="API:id_name_store">1</advertiser_id><advertiser_name
50
- xmlns="API:id_name_store">ad2games GmbH</advertiser_name></advertiser><offer><offer_id
51
- xmlns="API:id_name_store">-1</offer_id><offer_name xmlns="API:id_name_store">Global
52
- Redirect</offer_name></offer><offer_contract><offer_contract_id xmlns="API:id_name_store">-1</offer_contract_id><offer_contract_name
53
- xmlns="API:id_name_store" /></offer_contract><campaign_id>-1</campaign_id><creative><creative_id
54
- xmlns="API:id_name_store">-1</creative_id><creative_name xmlns="API:id_name_store">-1
55
- - Global Redirect</creative_name></creative><sub_id_1 /><sub_id_2 /><sub_id_3
56
- /><sub_id_4 /><sub_id_5 /><ip_address>184.72.184.113</ip_address><user_agent>Cloud%20mapping%20experiment.%20Contact%20research@pdrlabs.net</user_agent><referrer_url
57
- /><search_term /><request_url>http://94.236.50.153/</request_url><redirect_url>http://www.getcake.com</redirect_url><country><country_code
53
+ xmlns="http://cakemarketing.com/api/11/"><ClicksResult><success>true</success><row_count>470134</row_count><clicks><click><click_id>1633967829</click_id><visitor_id>964629655</visitor_id><tracking_id>1251217875</tracking_id><request_session_id>1602923077</request_session_id><click_date>2017-06-01T01:59:59.95</click_date><source_affiliate><source_affiliate_id
54
+ xmlns="API:id_name_store">26833</source_affiliate_id><source_affiliate_name
55
+ xmlns="API:id_name_store">Funtomic Adstack</source_affiliate_name></source_affiliate><brand_advertiser><brand_advertiser_id
56
+ xmlns="API:id_name_store">15176</brand_advertiser_id><brand_advertiser_name
57
+ xmlns="API:id_name_store">Star Stable Entertainment AB</brand_advertiser_name></brand_advertiser><site_offer><site_offer_id
58
+ xmlns="API:id_name_store">16698</site_offer_id><site_offer_name xmlns="API:id_name_store">Star
59
+ Stable (US SOI)</site_offer_name></site_offer><site_offer_contract><site_offer_contract_id
60
+ xmlns="API:id_name_store">22508</site_offer_contract_id><site_offer_contract_name
61
+ xmlns="API:id_name_store">Direct</site_offer_contract_name></site_offer_contract><campaign><campaign_id>646697</campaign_id><campaign_type><campaign_type_id>1</campaign_type_id><campaign_type_name>Standard</campaign_type_name></campaign_type></campaign><creative><creative_id
62
+ xmlns="API:id_name_store">211068</creative_id><creative_name xmlns="API:id_name_store">211068</creative_name></creative><sub_id_1
63
+ /><sub_id_2>CRpyl4PCacTC-9QTL_8kUg</sub_id_2><sub_id_3>as~</sub_id_3><sub_id_4
64
+ /><sub_id_5 /><ip_address>73.47.22.147</ip_address><user_agent>Mozilla/5.0%20(Windows%20NT%2010.0;%20WOW64)%20AppleWebKit/537.36%20(KHTML,%20like%20Gecko)%20Chrome/58.0.3029.110%20Safari/537.36</user_agent><referrer_url>http://kizi.com/games/c/family-barn?ref=big_thumb</referrer_url><search_term
65
+ /><request_url>https://a2g-secure.com/?a=26833&amp;c=211068&amp;s1=&amp;s2=CRpyl4PCacTC-9QTL_8kUg&amp;s3=as~</request_url><redirect_url>https://www.starstable.com/en/creation/offer?affiliate=AD2&amp;utm_source=ad2&amp;utm_medium=cpl&amp;referrer=12344&amp;utm_term=standard&amp;utm_content=empty&amp;AffId=#affid#_#s1#&amp;utm_campaign=US-ad2-Display-Star-Stable&amp;ClickID=#reqid#</redirect_url><country><country_code
58
66
  xmlns="API:id_name_store">US</country_code><country_name xmlns="API:id_name_store">United
59
- States</country_name></country><region><region_code xmlns="API:id_name_store">VA</region_code><region_name
60
- xmlns="API:id_name_store">Virginia</region_name></region><isp><isp_id xmlns="API:id_name_store">29534</isp_id><isp_name
61
- xmlns="API:id_name_store">Amazon.Com Inc.</isp_name></isp><disposition>Base
62
- Tracking Domain Redirect</disposition><total_clicks>1</total_clicks></click></clicks></ClicksResult></ClicksResponse></soap:Body></soap:Envelope>
67
+ States</country_name></country><region><region_code xmlns="API:id_name_store">NH</region_code><region_name
68
+ xmlns="API:id_name_store">New Hampshire</region_name></region><language><language_id
69
+ xmlns="API:id_name_store">1</language_id><language_name xmlns="API:id_name_store">English</language_name></language><isp><isp_id
70
+ xmlns="API:id_name_store">16357</isp_id><isp_name xmlns="API:id_name_store">Comcast
71
+ Cable Communications Inc.</isp_name></isp><operating_system><operating_system_id>18</operating_system_id><operating_system_name>Windows</operating_system_name><operating_system_version><version_id
72
+ xmlns="API:id_name_store">1</version_id><version_name xmlns="API:id_name_store">Other</version_name></operating_system_version><operating_system_version_minor><version_id
73
+ xmlns="API:id_name_store">1</version_id><version_name xmlns="API:id_name_store"
74
+ /></operating_system_version_minor></operating_system><browser><browser_id>2</browser_id><browser_name>Chrome</browser_name><browser_version><version_id
75
+ xmlns="API:id_name_store">460</version_id><version_name xmlns="API:id_name_store">58</version_name></browser_version><browser_version_minor><version_id
76
+ xmlns="API:id_name_store">691</version_id><version_name xmlns="API:id_name_store">58.0</version_name></browser_version_minor></browser><disposition
77
+ /><duplicate>false</duplicate><duplicate_clicks>0</duplicate_clicks><total_clicks>1</total_clicks></click></clicks></ClicksResult></ClicksResponse></soap:Body></soap:Envelope>
63
78
  http_version:
64
- recorded_at: Fri, 13 Feb 2015 14:29:53 GMT
79
+ recorded_at: Mon, 15 Jun 2015 12:00:00 GMT
65
80
  recorded_with: VCR 2.9.3
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  RSpec.describe SoapyCake::AdminAddedit do
3
4
  subject(:admin_addedit) { described_class.new }
4
5
 
@@ -1,8 +1,10 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  RSpec.describe SoapyCake::Admin do
3
4
  around { |example| Timecop.freeze(Time.utc(2015, 6, 15, 12), &example) }
4
5
 
5
6
  let(:logger) { instance_double(Logger) }
7
+
6
8
  before { allow(logger).to receive(:info) }
7
9
 
8
10
  subject(:admin) { described_class.new(logger: logger) }
@@ -40,15 +42,15 @@ RSpec.describe SoapyCake::Admin do
40
42
 
41
43
  it 'returns a clicks report with a defined time range', :vcr do
42
44
  result = admin.clicks(
43
- start_date: Date.new(2014, 6, 30),
44
- end_date: Date.new(2014, 7, 1),
45
+ start_date: Date.new(2017, 5, 31),
46
+ end_date: Date.new(2017, 6, 1),
45
47
  row_limit: 1
46
48
  )
47
49
 
48
50
  expect(result.count).to eq(1)
49
51
  expect(result.first).to include(
50
- click_id: 1275452,
51
- visitor_id: 1208222
52
+ click_id: 1633967829,
53
+ visitor_id: 964629655
52
54
  )
53
55
  end
54
56
 
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'spec_helper'
3
4
 
4
5
  RSpec.describe SoapyCake::AdminTrack do
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  RSpec.describe SoapyCake::Campaigns, :vcr do
3
4
  let(:offer_id) { 11390 }
4
5
  let(:affiliate_id) { 9643 }
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  RSpec.describe SoapyCake::AdminAddedit do
3
4
  subject(:admin_addedit) { described_class.new }
4
5
 
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  RSpec.describe SoapyCake::AdminBatched do
3
4
  subject(:admin_batched) { described_class.new }
5
+
4
6
  let(:admin) { instance_double(SoapyCake::Admin, xml_response?: false) }
5
7
 
6
8
  before do
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  RSpec.describe SoapyCake::Admin do
3
4
  subject(:admin) { described_class.new }
5
+
4
6
  let(:opts) { nil }
5
7
  let(:cake_opts) { opts }
6
8
  let(:cake_method) { method }
@@ -11,22 +13,26 @@ RSpec.describe SoapyCake::Admin do
11
13
  describe '#affiliate_bills' do
12
14
  let(:method) { :affiliate_bills }
13
15
  let(:cake_method) { :export_affiliate_bills }
16
+
14
17
  it_behaves_like 'a cake admin method'
15
18
  end
16
19
 
17
20
  describe '#advertiser_bills' do
18
21
  let(:method) { :advertiser_bills }
19
22
  let(:cake_method) { :export_advertiser_bills }
23
+
20
24
  it_behaves_like 'a cake admin method'
21
25
  end
22
26
 
23
27
  describe '#mark_affiliate_bill_as_received' do
24
28
  let(:method) { :mark_affiliate_bill_as_received }
29
+
25
30
  it_behaves_like 'a cake admin method'
26
31
  end
27
32
 
28
33
  describe '#mark_affiliate_bill_as_paid' do
29
34
  let(:method) { :mark_affiliate_bill_as_paid }
35
+
30
36
  it_behaves_like 'a cake admin method'
31
37
  end
32
38
  end
@@ -36,26 +42,31 @@ RSpec.describe SoapyCake::Admin do
36
42
 
37
43
  describe '#advertisers' do
38
44
  let(:method) { :advertisers }
45
+
39
46
  it_behaves_like 'a cake admin method'
40
47
  end
41
48
 
42
49
  describe '#affiliates' do
43
50
  let(:method) { :affiliates }
51
+
44
52
  it_behaves_like 'a cake admin method'
45
53
  end
46
54
 
47
55
  describe '#campaigns' do
48
56
  let(:method) { :campaigns }
57
+
49
58
  it_behaves_like 'a cake admin method'
50
59
  end
51
60
 
52
61
  describe '#offers' do
53
62
  let(:method) { :offers }
63
+
54
64
  it_behaves_like 'a cake admin method'
55
65
  end
56
66
 
57
67
  describe '#creatives' do
58
68
  let(:method) { :creatives }
69
+
59
70
  it_behaves_like 'a cake admin method'
60
71
  end
61
72
  end
@@ -65,37 +76,44 @@ RSpec.describe SoapyCake::Admin do
65
76
 
66
77
  describe '#campaign_summary' do
67
78
  let(:method) { :campaign_summary }
79
+
68
80
  it_behaves_like 'a cake admin method'
69
81
  end
70
82
 
71
83
  describe '#offer_summary' do
72
84
  let(:method) { :offer_summary }
85
+
73
86
  it_behaves_like 'a cake admin method'
74
87
  end
75
88
 
76
89
  describe '#affiliate_summary' do
77
90
  let(:method) { :affiliate_summary }
91
+
78
92
  it_behaves_like 'a cake admin method'
79
93
  end
80
94
 
81
95
  describe '#advertiser_summary' do
82
96
  let(:method) { :advertiser_summary }
97
+
83
98
  it_behaves_like 'a cake admin method'
84
99
  end
85
100
 
86
101
  describe '#clicks' do
87
102
  let(:method) { :clicks }
103
+
88
104
  it_behaves_like 'a cake admin method'
89
105
  end
90
106
 
91
107
  describe '#conversions' do
92
108
  let(:method) { :conversions }
93
109
  let(:cake_opts) { { conversion_type: 'conversions' } }
110
+
94
111
  it_behaves_like 'a cake admin method'
95
112
  end
96
113
 
97
114
  describe '#conversion_changes' do
98
115
  let(:method) { :conversion_changes }
116
+
99
117
  it_behaves_like 'a cake admin method'
100
118
  end
101
119
 
@@ -103,18 +121,21 @@ RSpec.describe SoapyCake::Admin do
103
121
  let(:method) { :events }
104
122
  let(:cake_method) { :conversions }
105
123
  let(:cake_opts) { { conversion_type: 'events' } }
124
+
106
125
  it_behaves_like 'a cake admin method'
107
126
  end
108
127
 
109
128
  describe '#traffic' do
110
129
  let(:method) { :traffic }
111
130
  let(:cake_method) { :traffic_export }
131
+
112
132
  it_behaves_like 'a cake admin method'
113
133
  end
114
134
 
115
135
  describe '#caps' do
116
136
  let(:method) { :caps }
117
137
  let(:cake_opts) { { start_date: '2015-07-01', end_date: '2015-07-07' } }
138
+
118
139
  it_behaves_like 'a cake admin method'
119
140
  end
120
141
  end
@@ -125,23 +146,27 @@ RSpec.describe SoapyCake::Admin do
125
146
  describe '#verticals' do
126
147
  let(:method) { :verticals }
127
148
  let(:cake_opts) { nil }
149
+
128
150
  it_behaves_like 'a cake admin method'
129
151
  end
130
152
 
131
153
  describe '#countries' do
132
154
  let(:method) { :countries }
155
+
133
156
  it_behaves_like 'a cake admin method'
134
157
  end
135
158
 
136
159
  describe '#currencies' do
137
160
  let(:method) { :currencies }
138
161
  let(:cake_opts) { nil }
162
+
139
163
  it_behaves_like 'a cake admin method'
140
164
  end
141
165
 
142
166
  describe '#exchange_rates' do
143
167
  let(:method) { :exchange_rates }
144
168
  let(:cake_opts) { { start_date: '2015-07-01', end_date: '2015-07-07' } }
169
+
145
170
  it_behaves_like 'a cake admin method'
146
171
  end
147
172
 
@@ -149,12 +174,14 @@ RSpec.describe SoapyCake::Admin do
149
174
  let(:method) { :tiers }
150
175
  let(:cake_method) { :affiliate_tiers }
151
176
  let(:cake_opts) { nil }
177
+
152
178
  it_behaves_like 'a cake admin method'
153
179
  end
154
180
 
155
181
  describe '#blacklist_reasons' do
156
182
  let(:method) { :blacklist_reasons }
157
183
  let(:cake_opts) { nil }
184
+
158
185
  it_behaves_like 'a cake admin method'
159
186
  end
160
187
  end
@@ -165,12 +192,14 @@ RSpec.describe SoapyCake::Admin do
165
192
  describe '#update_creative' do
166
193
  let(:method) { :update_creative }
167
194
  let(:cake_method) { :creative }
195
+
168
196
  it_behaves_like 'a cake admin method'
169
197
  end
170
198
 
171
199
  describe '#update_campaign' do
172
200
  let(:method) { :update_campaign }
173
201
  let(:cake_method) { :campaign }
202
+
174
203
  it_behaves_like 'a cake admin method'
175
204
  end
176
205
 
@@ -204,12 +233,14 @@ RSpec.describe SoapyCake::Admin do
204
233
  describe '#affiliate_signup' do
205
234
  let(:method) { :affiliate_signup }
206
235
  let(:cake_method) { :affiliate }
236
+
207
237
  it_behaves_like 'a cake admin method'
208
238
  end
209
239
 
210
240
  describe '#media_types' do
211
241
  let(:method) { :media_types }
212
242
  let(:cake_method) { :get_media_types }
243
+
213
244
  it_behaves_like 'a cake admin method'
214
245
 
215
246
  it 'uses a local response' do
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'spec_helper'
3
4
 
4
5
  RSpec.describe SoapyCake::AdminTrack do
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  RSpec.describe SoapyCake::Affiliate do
3
4
  let(:affiliate_id) { 42 }
4
5
  let(:opts) { { a: 1 } }
@@ -21,12 +22,14 @@ RSpec.describe SoapyCake::Affiliate do
21
22
  describe '#bills' do
22
23
  let(:service) { :reports }
23
24
  let(:method) { :bills }
25
+
24
26
  it_behaves_like 'a cake affiliate method'
25
27
  end
26
28
 
27
29
  describe '#offer_feed' do
28
30
  let(:service) { :offers }
29
31
  let(:method) { :offer_feed }
32
+
30
33
  it_behaves_like 'a cake affiliate method'
31
34
  end
32
35
  end
@@ -1,14 +1,10 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  RSpec.describe SoapyCake::Campaigns do
3
4
  let(:campaigns) { described_class.new }
4
5
  let(:client) { instance_double(SoapyCake::Client) }
5
6
  let(:campaign_id) { 1 }
6
7
 
7
- before do
8
- allow(SoapyCake::Client).to receive(:new).and_return(client)
9
- allow(client).to receive(:run).with(an_instance_of(SoapyCake::Request))
10
- end
11
-
12
8
  let(:default_params) do
13
9
  {
14
10
  affiliate_id: 1,
@@ -26,6 +22,11 @@ RSpec.describe SoapyCake::Campaigns do
26
22
  }
27
23
  end
28
24
 
25
+ before do
26
+ allow(SoapyCake::Client).to receive(:new).and_return(client)
27
+ allow(client).to receive(:run).with(an_instance_of(SoapyCake::Request))
28
+ end
29
+
29
30
  def expect_request_to_be_built_with(opts)
30
31
  expect(SoapyCake::Request).to receive(:new).with(
31
32
  :admin,
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  RSpec.describe SoapyCake::ModificationType do
3
4
  subject(:output_opts) do
4
5
  described_class.new(:foo, :foo_mod_type, 'bar').options(input_opts)
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  RSpec.describe SoapyCake::Request do
3
4
  it 'raises if there is no api version stored' do
4
5
  expect do
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  RSpec.describe SoapyCake::Response do
3
4
  let(:xml) do
4
5
  <<-EOD
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  RSpec.describe SoapyCake::ResponseValue do
3
4
  let(:time_converter) { instance_double(SoapyCake::TimeConverter) }
4
5
 
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  RSpec.describe SoapyCake::TimeConverter do
3
4
  subject(:time_converter) { described_class.new('Europe/Berlin') }
4
5
 
data/spec/spec_helper.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'simplecov'
3
4
  SimpleCov.start do
4
5
  add_filter '/spec/'
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  RSpec.shared_examples_for 'a cake admin method' do
3
4
  subject(:admin) { described_class.new }
5
+
4
6
  let(:request) { instance_double(SoapyCake::Request) }
5
7
 
6
8
  it 'runs the request' do
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.3
4
+ version: 2.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - ad2games GmbH
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-05 00:00:00.000000000 Z
11
+ date: 2017-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -271,7 +271,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
271
271
  version: '0'
272
272
  requirements: []
273
273
  rubyforge_project:
274
- rubygems_version: 2.5.2
274
+ rubygems_version: 2.5.1
275
275
  signing_key:
276
276
  specification_version: 4
277
277
  summary: Simple client for the CAKE API