soapy_cake 0.3.4 → 1.0.0
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 +4 -4
- data/.rspec +1 -0
- data/api_versions.yml +110 -110
- data/lib/soapy_cake.rb +10 -2
- data/lib/soapy_cake/admin.rb +34 -46
- data/lib/soapy_cake/affiliate.rb +5 -17
- data/lib/soapy_cake/client.rb +33 -3
- data/lib/soapy_cake/error.rb +4 -0
- data/lib/soapy_cake/helper.rb +16 -0
- data/lib/soapy_cake/request.rb +61 -0
- data/lib/soapy_cake/response.rb +48 -0
- data/lib/soapy_cake/version.rb +1 -1
- data/soapy_cake.gemspec +4 -4
- data/spec/fixtures/vcr_cassettes/Integration_test/raises_if_there_is_an_error.yml +50 -0
- data/spec/fixtures/vcr_cassettes/Integration_test/returns_an_affiliate_with_correct_data_types.yml +114 -0
- data/spec/lib/soapy_cake/admin_spec.rb +87 -199
- data/spec/lib/soapy_cake/affiliate_spec.rb +19 -39
- data/spec/lib/soapy_cake/integration_spec.rb +25 -0
- data/spec/spec_helper.rb +2 -0
- metadata +14 -55
- data/lib/soapy_cake/advertiser.rb +0 -21
- data/lib/soapy_cake/client/cake_client.rb +0 -157
- data/lib/soapy_cake/client/http_client.rb +0 -14
- data/spec/fixtures/vcr_cassettes/client_new_account_statuses.yml +0 -1200
- data/spec/fixtures/vcr_cassettes/client_new_advertisers.yml +0 -1202
- data/spec/fixtures/vcr_cassettes/client_new_affiliate_tags.yml +0 -1200
- data/spec/fixtures/vcr_cassettes/client_new_affiliate_tiers.yml +0 -1201
- data/spec/fixtures/vcr_cassettes/client_new_billing_cycles.yml +0 -1200
- data/spec/fixtures/vcr_cassettes/client_new_cap_intervals.yml +0 -1201
- data/spec/fixtures/vcr_cassettes/client_new_cap_types.yml +0 -1199
- data/spec/fixtures/vcr_cassettes/client_new_countries.yml +0 -1515
- data/spec/fixtures/vcr_cassettes/client_new_currencies.yml +0 -1199
- data/spec/fixtures/vcr_cassettes/client_new_empty_response.yml +0 -1200
- data/spec/fixtures/vcr_cassettes/client_new_empty_response_offer_summary.yml +0 -865
- data/spec/fixtures/vcr_cassettes/client_new_languages.yml +0 -1199
- data/spec/fixtures/vcr_cassettes/client_new_media_types.yml +0 -1215
- data/spec/fixtures/vcr_cassettes/client_new_offer_statuses.yml +0 -1202
- data/spec/fixtures/vcr_cassettes/client_new_offer_types.yml +0 -1201
- data/spec/fixtures/vcr_cassettes/client_new_payment_settings.yml +0 -1203
- data/spec/fixtures/vcr_cassettes/client_new_payment_types.yml +0 -1204
- data/spec/fixtures/vcr_cassettes/client_new_price_formats.yml +0 -1202
- data/spec/fixtures/vcr_cassettes/client_new_roles.yml +0 -1203
- data/spec/fixtures/vcr_cassettes/client_new_verticals.yml +0 -1197
- data/spec/fixtures/vcr_cassettes/client_new_with_username_and_password.yml +0 -1198
- data/spec/fixtures/vcr_cassettes/client_sekken_client_caches_results.yml +0 -1261
- data/spec/lib/soapy_cake/advertiser_spec.rb +0 -14
- data/spec/lib/soapy_cake/client/cake_client_spec.rb +0 -197
| @@ -0,0 +1,16 @@ | |
| 1 | 
            +
            module SoapyCake
         | 
| 2 | 
            +
              module Helper
         | 
| 3 | 
            +
                def self.walk_tree(obj, key = nil, &block)
         | 
| 4 | 
            +
                  return nil if obj == {}
         | 
| 5 | 
            +
             | 
| 6 | 
            +
                  case obj
         | 
| 7 | 
            +
                  when Hash
         | 
| 8 | 
            +
                    obj.map { |hk, hv| [hk, walk_tree(hv, hk, &block)] }.to_h
         | 
| 9 | 
            +
                  when Array
         | 
| 10 | 
            +
                    obj.map { |av| walk_tree(av, &block) }
         | 
| 11 | 
            +
                  else
         | 
| 12 | 
            +
                    yield(obj, key)
         | 
| 13 | 
            +
                  end
         | 
| 14 | 
            +
                end
         | 
| 15 | 
            +
              end
         | 
| 16 | 
            +
            end
         | 
| @@ -0,0 +1,61 @@ | |
| 1 | 
            +
            module SoapyCake
         | 
| 2 | 
            +
              class Request
         | 
| 3 | 
            +
                attr_accessor :api_key, :time_offset
         | 
| 4 | 
            +
                attr_reader :role, :service, :method, :opts
         | 
| 5 | 
            +
             | 
| 6 | 
            +
                def initialize(role, service, method, opts = {})
         | 
| 7 | 
            +
                  @role = role.to_s
         | 
| 8 | 
            +
                  @service = service.to_s
         | 
| 9 | 
            +
                  @method = method.to_s
         | 
| 10 | 
            +
                  @opts = opts
         | 
| 11 | 
            +
                end
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                def path
         | 
| 14 | 
            +
                  "/#{(role != 'admin') ? role : ''}/api/#{version}/#{service}.asmx"
         | 
| 15 | 
            +
                end
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                def xml
         | 
| 18 | 
            +
                  Nokogiri::XML::Builder.new do |xml|
         | 
| 19 | 
            +
                    xml['env'].Envelope(xml_namespaces) do
         | 
| 20 | 
            +
                      xml.Header
         | 
| 21 | 
            +
                      xml.Body do
         | 
| 22 | 
            +
                        xml['cake'].send(method.camelize.to_sym) do
         | 
| 23 | 
            +
                          xml_params(xml)
         | 
| 24 | 
            +
                        end
         | 
| 25 | 
            +
                      end
         | 
| 26 | 
            +
                    end
         | 
| 27 | 
            +
                  end.to_xml
         | 
| 28 | 
            +
                end
         | 
| 29 | 
            +
             | 
| 30 | 
            +
                private
         | 
| 31 | 
            +
             | 
| 32 | 
            +
                def xml_params(xml)
         | 
| 33 | 
            +
                  xml.api_key api_key
         | 
| 34 | 
            +
                  opts.each do |k, v|
         | 
| 35 | 
            +
                    xml.send(k.to_sym, format_param(v))
         | 
| 36 | 
            +
                  end
         | 
| 37 | 
            +
                end
         | 
| 38 | 
            +
             | 
| 39 | 
            +
                def xml_namespaces
         | 
| 40 | 
            +
                  {
         | 
| 41 | 
            +
                    'xmlns:env' => 'http://www.w3.org/2003/05/soap-envelope',
         | 
| 42 | 
            +
                    'xmlns:cake' => "http://cakemarketing.com/api/#{version}/"
         | 
| 43 | 
            +
                  }
         | 
| 44 | 
            +
                end
         | 
| 45 | 
            +
             | 
| 46 | 
            +
                def format_param(value)
         | 
| 47 | 
            +
                  case value
         | 
| 48 | 
            +
                  when Time, DateTime, Date
         | 
| 49 | 
            +
                    (value.to_datetime.utc + time_offset.to_i.hours).strftime('%Y-%m-%dT%H:%M:%S')
         | 
| 50 | 
            +
                  else
         | 
| 51 | 
            +
                    value
         | 
| 52 | 
            +
                  end
         | 
| 53 | 
            +
                end
         | 
| 54 | 
            +
             | 
| 55 | 
            +
                def version
         | 
| 56 | 
            +
                  API_VERSIONS[role][service][method] || fail
         | 
| 57 | 
            +
                rescue
         | 
| 58 | 
            +
                  raise(Error, "Unknown API call #{role}::#{service}::#{method}")
         | 
| 59 | 
            +
                end
         | 
| 60 | 
            +
              end
         | 
| 61 | 
            +
            end
         | 
| @@ -0,0 +1,48 @@ | |
| 1 | 
            +
            module SoapyCake
         | 
| 2 | 
            +
              class Response
         | 
| 3 | 
            +
                attr_accessor :time_offset
         | 
| 4 | 
            +
                attr_reader :body
         | 
| 5 | 
            +
             | 
| 6 | 
            +
                def initialize(body)
         | 
| 7 | 
            +
                  @body = body
         | 
| 8 | 
            +
                end
         | 
| 9 | 
            +
             | 
| 10 | 
            +
                def collection
         | 
| 11 | 
            +
                  check_errors!
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                  sax.at_depth(5).map do |element|
         | 
| 14 | 
            +
                    typed_element(element)
         | 
| 15 | 
            +
                  end
         | 
| 16 | 
            +
                end
         | 
| 17 | 
            +
             | 
| 18 | 
            +
                private
         | 
| 19 | 
            +
             | 
| 20 | 
            +
                def typed_element(element)
         | 
| 21 | 
            +
                  Helper.walk_tree(element) do |value, key|
         | 
| 22 | 
            +
                    next value.to_i if key.to_s.end_with?('_id')
         | 
| 23 | 
            +
             | 
| 24 | 
            +
                    if /\A\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.?\d*\z/.match(value)
         | 
| 25 | 
            +
                      next DateTime.parse(value + format('%+03d:00', time_offset.to_i))
         | 
| 26 | 
            +
                    end
         | 
| 27 | 
            +
             | 
| 28 | 
            +
                    next false if value == 'false'
         | 
| 29 | 
            +
                    next true if value == 'true'
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                    value
         | 
| 32 | 
            +
                  end
         | 
| 33 | 
            +
                end
         | 
| 34 | 
            +
             | 
| 35 | 
            +
                def sax
         | 
| 36 | 
            +
                  @sax ||= Saxerator.parser(StringIO.new(body)) do |config|
         | 
| 37 | 
            +
                    config.symbolize_keys!
         | 
| 38 | 
            +
                    config.ignore_namespaces!
         | 
| 39 | 
            +
                  end
         | 
| 40 | 
            +
                end
         | 
| 41 | 
            +
             | 
| 42 | 
            +
                def check_errors!
         | 
| 43 | 
            +
                  fault = sax.for_tag(:fault).first
         | 
| 44 | 
            +
                  fail RequestFailed, fault[:reason][:text] if fault
         | 
| 45 | 
            +
                  fail RequestFailed, sax.for_tag(:Text).first unless sax.for_tag(:success).first == 'true'
         | 
| 46 | 
            +
                end
         | 
| 47 | 
            +
              end
         | 
| 48 | 
            +
            end
         | 
    
        data/lib/soapy_cake/version.rb
    CHANGED
    
    
    
        data/soapy_cake.gemspec
    CHANGED
    
    | @@ -14,13 +14,13 @@ Gem::Specification.new do |spec| | |
| 14 14 | 
             
              spec.license       = 'MIT'
         | 
| 15 15 |  | 
| 16 16 | 
             
              spec.files         = `git ls-files -z`.split("\x0")
         | 
| 17 | 
            -
              spec.executables   = spec.files.grep( | 
| 18 | 
            -
              spec.test_files    = spec.files.grep( | 
| 17 | 
            +
              spec.executables   = spec.files.grep(/^bin\//) { |f| File.basename(f) }
         | 
| 18 | 
            +
              spec.test_files    = spec.files.grep(/^(test|spec|features)\//)
         | 
| 19 19 | 
             
              spec.require_paths = ['lib']
         | 
| 20 20 |  | 
| 21 21 | 
             
              spec.add_dependency 'activesupport'
         | 
| 22 | 
            -
              spec.add_dependency ' | 
| 23 | 
            -
              spec.add_dependency ' | 
| 22 | 
            +
              spec.add_dependency 'saxerator'
         | 
| 23 | 
            +
              spec.add_dependency 'nokogiri'
         | 
| 24 24 | 
             
              spec.add_dependency 'httparty'
         | 
| 25 25 |  | 
| 26 26 | 
             
              spec.add_development_dependency 'bundler'
         | 
| @@ -0,0 +1,50 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            http_interactions:
         | 
| 3 | 
            +
            - request:
         | 
| 4 | 
            +
                method: post
         | 
| 5 | 
            +
                uri: https://cake-partner-domain.com//api/5/export.asmx
         | 
| 6 | 
            +
                body:
         | 
| 7 | 
            +
                  encoding: UTF-8
         | 
| 8 | 
            +
                  string: |
         | 
| 9 | 
            +
                    <?xml version="1.0"?>
         | 
| 10 | 
            +
                    <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:cake="http://cakemarketing.com/api/5/">
         | 
| 11 | 
            +
                      <env:Header/>
         | 
| 12 | 
            +
                      <env:Body>
         | 
| 13 | 
            +
                        <cake:Affiliates>
         | 
| 14 | 
            +
                          <cake:api_key>cake-api-key</cake:api_key>
         | 
| 15 | 
            +
                          <cake:affiliate_id>bloops</cake:affiliate_id>
         | 
| 16 | 
            +
                        </cake:Affiliates>
         | 
| 17 | 
            +
                      </env:Body>
         | 
| 18 | 
            +
                    </env:Envelope>
         | 
| 19 | 
            +
                headers:
         | 
| 20 | 
            +
                  Content-Type:
         | 
| 21 | 
            +
                  - application/soap+xml;charset=UTF-8
         | 
| 22 | 
            +
              response:
         | 
| 23 | 
            +
                status:
         | 
| 24 | 
            +
                  code: 500
         | 
| 25 | 
            +
                  message: Internal Server Error
         | 
| 26 | 
            +
                headers:
         | 
| 27 | 
            +
                  Cache-Control:
         | 
| 28 | 
            +
                  - private
         | 
| 29 | 
            +
                  Content-Type:
         | 
| 30 | 
            +
                  - application/soap+xml; charset=utf-8
         | 
| 31 | 
            +
                  Server:
         | 
| 32 | 
            +
                  - Microsoft-IIS/8.0
         | 
| 33 | 
            +
                  X-Aspnet-Version:
         | 
| 34 | 
            +
                  - 4.0.30319
         | 
| 35 | 
            +
                  X-Powered-By:
         | 
| 36 | 
            +
                  - ASP.NET
         | 
| 37 | 
            +
                  Date:
         | 
| 38 | 
            +
                  - Tue, 10 Feb 2015 13:00:42 GMT
         | 
| 39 | 
            +
                  Content-Length:
         | 
| 40 | 
            +
                  - '542'
         | 
| 41 | 
            +
                body:
         | 
| 42 | 
            +
                  encoding: UTF-8
         | 
| 43 | 
            +
                  string: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
         | 
| 44 | 
            +
                    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><soap:Fault><soap:Code><soap:Value>soap:Sender</soap:Value></soap:Code><soap:Reason><soap:Text
         | 
| 45 | 
            +
                    xml:lang="en">Server was unable to read request. ---> There is an error
         | 
| 46 | 
            +
                    in XML document (7, 52). ---> Input string was not in a correct format.</soap:Text></soap:Reason><soap:Detail
         | 
| 47 | 
            +
                    /></soap:Fault></soap:Body></soap:Envelope>
         | 
| 48 | 
            +
                http_version: 
         | 
| 49 | 
            +
              recorded_at: Tue, 10 Feb 2015 13:00:44 GMT
         | 
| 50 | 
            +
            recorded_with: VCR 2.9.3
         | 
    
        data/spec/fixtures/vcr_cassettes/Integration_test/returns_an_affiliate_with_correct_data_types.yml
    ADDED
    
    | @@ -0,0 +1,114 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            http_interactions:
         | 
| 3 | 
            +
            - request:
         | 
| 4 | 
            +
                method: post
         | 
| 5 | 
            +
                uri: https://cake-partner-domain.com//api/5/export.asmx
         | 
| 6 | 
            +
                body:
         | 
| 7 | 
            +
                  encoding: UTF-8
         | 
| 8 | 
            +
                  string: |
         | 
| 9 | 
            +
                    <?xml version="1.0"?>
         | 
| 10 | 
            +
                    <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:cake="http://cakemarketing.com/api/5/">
         | 
| 11 | 
            +
                      <env:Header/>
         | 
| 12 | 
            +
                      <env:Body>
         | 
| 13 | 
            +
                        <cake:Affiliates>
         | 
| 14 | 
            +
                          <cake:api_key>cake-api-key</cake:api_key>
         | 
| 15 | 
            +
                          <cake:affiliate_id>16027</cake:affiliate_id>
         | 
| 16 | 
            +
                        </cake:Affiliates>
         | 
| 17 | 
            +
                      </env:Body>
         | 
| 18 | 
            +
                    </env:Envelope>
         | 
| 19 | 
            +
                headers:
         | 
| 20 | 
            +
                  Content-Type:
         | 
| 21 | 
            +
                  - application/soap+xml;charset=UTF-8
         | 
| 22 | 
            +
              response:
         | 
| 23 | 
            +
                status:
         | 
| 24 | 
            +
                  code: 200
         | 
| 25 | 
            +
                  message: OK
         | 
| 26 | 
            +
                headers:
         | 
| 27 | 
            +
                  Cache-Control:
         | 
| 28 | 
            +
                  - private, max-age=0
         | 
| 29 | 
            +
                  Content-Type:
         | 
| 30 | 
            +
                  - application/soap+xml; charset=utf-8
         | 
| 31 | 
            +
                  Server:
         | 
| 32 | 
            +
                  - Microsoft-IIS/8.0
         | 
| 33 | 
            +
                  X-Aspnet-Version:
         | 
| 34 | 
            +
                  - 4.0.30319
         | 
| 35 | 
            +
                  X-Powered-By:
         | 
| 36 | 
            +
                  - ASP.NET
         | 
| 37 | 
            +
                  Date:
         | 
| 38 | 
            +
                  - Tue, 10 Feb 2015 12:50:36 GMT
         | 
| 39 | 
            +
                  Content-Length:
         | 
| 40 | 
            +
                  - '3036'
         | 
| 41 | 
            +
                body:
         | 
| 42 | 
            +
                  encoding: ASCII-8BIT
         | 
| 43 | 
            +
                  string: !binary |-
         | 
| 44 | 
            +
                    PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c29hcDpF
         | 
| 45 | 
            +
                    bnZlbG9wZSB4bWxuczpzb2FwPSJodHRwOi8vd3d3LnczLm9yZy8yMDAzLzA1
         | 
| 46 | 
            +
                    L3NvYXAtZW52ZWxvcGUiIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcv
         | 
| 47 | 
            +
                    MjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiIHhtbG5zOnhzZD0iaHR0cDovL3d3
         | 
| 48 | 
            +
                    dy53My5vcmcvMjAwMS9YTUxTY2hlbWEiPjxzb2FwOkJvZHk+PEFmZmlsaWF0
         | 
| 49 | 
            +
                    ZXNSZXNwb25zZSB4bWxucz0iaHR0cDovL2Nha2VtYXJrZXRpbmcuY29tL2Fw
         | 
| 50 | 
            +
                    aS81LyI+PEFmZmlsaWF0ZXNSZXN1bHQ+PHN1Y2Nlc3M+dHJ1ZTwvc3VjY2Vz
         | 
| 51 | 
            +
                    cz48cm93X2NvdW50PjE8L3Jvd19jb3VudD48YWZmaWxpYXRlcz48YWZmaWxp
         | 
| 52 | 
            +
                    YXRlPjxhZmZpbGlhdGVfaWQ+MTYwMjc8L2FmZmlsaWF0ZV9pZD48YWZmaWxp
         | 
| 53 | 
            +
                    YXRlX25hbWU+QWZmaWxpYXRlIFRlc3QgMTwvYWZmaWxpYXRlX25hbWU+PHRp
         | 
| 54 | 
            +
                    ZXI+PGFmZmlsaWF0ZV90aWVyX2lkIHhtbG5zPSJBUEk6aWRfbmFtZV9zdG9y
         | 
| 55 | 
            +
                    ZSI+NTwvYWZmaWxpYXRlX3RpZXJfaWQ+PGFmZmlsaWF0ZV90aWVyX25hbWUg
         | 
| 56 | 
            +
                    eG1sbnM9IkFQSTppZF9uYW1lX3N0b3JlIj5icm9uemUgdGllcjwvYWZmaWxp
         | 
| 57 | 
            +
                    YXRlX3RpZXJfbmFtZT48L3RpZXI+PGFjY291bnRfbWFuYWdlcnM+PGNvbnRh
         | 
| 58 | 
            +
                    Y3Q+PGNvbnRhY3RfaWQgeG1sbnM9IkFQSTppZF9uYW1lX3N0b3JlIj4xNzU8
         | 
| 59 | 
            +
                    L2NvbnRhY3RfaWQ+PGNvbnRhY3RfbmFtZSB4bWxucz0iQVBJOmlkX25hbWVf
         | 
| 60 | 
            +
                    c3RvcmUiPlBhcnRuZXIgU3VwcG9ydDwvY29udGFjdF9uYW1lPjwvY29udGFj
         | 
| 61 | 
            +
                    dD48L2FjY291bnRfbWFuYWdlcnM+PGFjY291bnRfc3RhdHVzPjxhY2NvdW50
         | 
| 62 | 
            +
                    X3N0YXR1c19pZCB4bWxucz0iQVBJOmlkX25hbWVfc3RvcmUiPjE8L2FjY291
         | 
| 63 | 
            +
                    bnRfc3RhdHVzX2lkPjxhY2NvdW50X3N0YXR1c19uYW1lIHhtbG5zPSJBUEk6
         | 
| 64 | 
            +
                    aWRfbmFtZV9zdG9yZSI+QWN0aXZlPC9hY2NvdW50X3N0YXR1c19uYW1lPjwv
         | 
| 65 | 
            +
                    YWNjb3VudF9zdGF0dXM+PGFkZHJlc3M+PHN0cmVldF8xIC8+PHN0cmVldF8y
         | 
| 66 | 
            +
                    IC8+PGNpdHkgLz48c3RhdGUgLz48emlwX2NvZGUgLz48Y291bnRyeSAvPjwv
         | 
| 67 | 
            +
                    YWRkcmVzcz48d2Vic2l0ZSAvPjxwYXltZW50X3R5cGU+PHBheW1lbnRfdHlw
         | 
| 68 | 
            +
                    ZV9pZD40PC9wYXltZW50X3R5cGVfaWQ+PHBheW1lbnRfdHlwZV9uYW1lPlBh
         | 
| 69 | 
            +
                    eVBhbDwvcGF5bWVudF90eXBlX25hbWU+PHBheW1lbnRfdHlwZV9pbmZvPmFA
         | 
| 70 | 
            +
                    YXNkZmFzLmNvbTwvcGF5bWVudF90eXBlX2luZm8+PC9wYXltZW50X3R5cGU+
         | 
| 71 | 
            +
                    PGNvbnRhY3RzIC8+PHRhZ3MgLz48dHJhZmZpY190eXBlcz48cHJpY2VfZm9y
         | 
| 72 | 
            +
                    bWF0cyAvPjxtZWRpYV90eXBlcyAvPjx2ZXJ0aWNhbF9jYXRlZ29yaWVzIC8+
         | 
| 73 | 
            +
                    PGNvdW50cmllcyAvPjwvdHJhZmZpY190eXBlcz48bWluaW11bV9wYXltZW50
         | 
| 74 | 
            +
                    X3RocmVzaG9sZD4wLjAwMDA8L21pbmltdW1fcGF5bWVudF90aHJlc2hvbGQ+
         | 
| 75 | 
            +
                    PGF1dG9fcGF5bWVudF9mZWU+MC4wMDAwPC9hdXRvX3BheW1lbnRfZmVlPjxw
         | 
| 76 | 
            +
                    YXltZW50X3RvPkNvbXBhbnk8L3BheW1lbnRfdG8+PHBheV92YXQ+ZmFsc2U8
         | 
| 77 | 
            +
                    L3BheV92YXQ+PHJlZmVycmFsc19lbmFibGVkPmZhbHNlPC9yZWZlcnJhbHNf
         | 
| 78 | 
            +
                    ZW5hYmxlZD48cmVmZXJyYWxfaW5mbyAvPjxiaWxsaW5nX2N5Y2xlPjxiaWxs
         | 
| 79 | 
            +
                    aW5nX2N5Y2xlX2lkIHhtbG5zPSJBUEk6aWRfbmFtZV9zdG9yZSI+MTwvYmls
         | 
| 80 | 
            +
                    bGluZ19jeWNsZV9pZD48YmlsbGluZ19jeWNsZV9uYW1lIHhtbG5zPSJBUEk6
         | 
| 81 | 
            +
                    aWRfbmFtZV9zdG9yZSI+V2Vla2x5PC9iaWxsaW5nX2N5Y2xlX25hbWU+PC9i
         | 
| 82 | 
            +
                    aWxsaW5nX2N5Y2xlPjxjdXJyZW5jeV9zZXR0aW5ncz48Y3VycmVuY3k+PGN1
         | 
| 83 | 
            +
                    cnJlbmN5X2lkIHhtbG5zPSJBUEk6aWRfbmFtZV9zdG9yZSI+MjwvY3VycmVu
         | 
| 84 | 
            +
                    Y3lfaWQ+PGN1cnJlbmN5X3N5bWJvbCB4bWxucz0iQVBJOmlkX25hbWVfc3Rv
         | 
| 85 | 
            +
                    cmUiPuKCrDwvY3VycmVuY3lfc3ltYm9sPjxjdXJyZW5jeV9uYW1lIHhtbG5z
         | 
| 86 | 
            +
                    PSJBUEk6aWRfbmFtZV9zdG9yZSI+RXVybzwvY3VycmVuY3lfbmFtZT48Y3Vy
         | 
| 87 | 
            +
                    cmVuY3lfYWJiciB4bWxucz0iQVBJOmlkX25hbWVfc3RvcmUiPkVVUjwvY3Vy
         | 
| 88 | 
            +
                    cmVuY3lfYWJicj48L2N1cnJlbmN5PjxwYXltZW50X3NldHRpbmc+PHBheW1l
         | 
| 89 | 
            +
                    bnRfc2V0dGluZ19pZCB4bWxucz0iQVBJOmlkX25hbWVfc3RvcmUiPjM8L3Bh
         | 
| 90 | 
            +
                    eW1lbnRfc2V0dGluZ19pZD48cGF5bWVudF9zZXR0aW5nX25hbWUgeG1sbnM9
         | 
| 91 | 
            +
                    IkFQSTppZF9uYW1lX3N0b3JlIj5QYXkgYWZmaWxpYXRlIGluIGFmZmlsaWF0
         | 
| 92 | 
            +
                    ZSdzIGN1cnJlbmN5PC9wYXltZW50X3NldHRpbmdfbmFtZT48L3BheW1lbnRf
         | 
| 93 | 
            +
                    c2V0dGluZz48L2N1cnJlbmN5X3NldHRpbmdzPjxxdWlja2Jvb2tzX2lkIHhz
         | 
| 94 | 
            +
                    aTpuaWw9InRydWUiIC8+PG9ubGluZV9zaWdudXA+ZmFsc2U8L29ubGluZV9z
         | 
| 95 | 
            +
                    aWdudXA+PHNpZ251cF9pcF9hZGRyZXNzIC8+PHBheV9mb3JfY29udmVyc2lv
         | 
| 96 | 
            +
                    bnM+dHJ1ZTwvcGF5X2Zvcl9jb252ZXJzaW9ucz48cmV2aWV3PmZhbHNlPC9y
         | 
| 97 | 
            +
                    ZXZpZXc+PHJldmlld19uZXdfc3ViYWZmaWxpYXRlcz5mYWxzZTwvcmV2aWV3
         | 
| 98 | 
            +
                    X25ld19zdWJhZmZpbGlhdGVzPjxzdXBwcmVzc2lvbj5mYWxzZTwvc3VwcHJl
         | 
| 99 | 
            +
                    c3Npb24+PHN1cHByZXNzaW9uX2NhcCB4c2k6bmlsPSJ0cnVlIiAvPjxwaXhl
         | 
| 100 | 
            +
                    bF9pbmZvPjxwaXhlbF9odG1sIC8+PHBvc3RiYWNrX3VybCAvPjxwb3N0YmFj
         | 
| 101 | 
            +
                    a19kZWxheV9tcyB4c2k6bmlsPSJ0cnVlIiAvPjwvcGl4ZWxfaW5mbz48Zmly
         | 
| 102 | 
            +
                    ZV9nbG9iYWxfcGl4ZWw+ZmFsc2U8L2ZpcmVfZ2xvYmFsX3BpeGVsPjxibGFj
         | 
| 103 | 
            +
                    a2xpc3RzIC8+PGF1dG9fYXBwcm92ZV9jYW1wYWlnbnM+ZmFsc2U8L2F1dG9f
         | 
| 104 | 
            +
                    YXBwcm92ZV9jYW1wYWlnbnM+PGF1dG9fYXBwcm92ZV9waXhlbHM+ZmFsc2U8
         | 
| 105 | 
            +
                    L2F1dG9fYXBwcm92ZV9waXhlbHM+PGhpZGVfb2ZmZXJzPmZhbHNlPC9oaWRl
         | 
| 106 | 
            +
                    X29mZmVycz48YXBpX2tleT5UY1huRHppazFrTm9kend3WGpvWUlRPC9hcGlf
         | 
| 107 | 
            +
                    a2V5PjxkYXRlX2NyZWF0ZWQ+MjAxNC0wNC0yOFQxMDo1MjoxNS41Mzc8L2Rh
         | 
| 108 | 
            +
                    dGVfY3JlYXRlZD48ZGF0ZV9sYXN0X2FjY2VwdGVkX3Rlcm1zIHhzaTpuaWw9
         | 
| 109 | 
            +
                    InRydWUiIC8+PG5vdGVzIC8+PC9hZmZpbGlhdGU+PC9hZmZpbGlhdGVzPjwv
         | 
| 110 | 
            +
                    QWZmaWxpYXRlc1Jlc3VsdD48L0FmZmlsaWF0ZXNSZXNwb25zZT48L3NvYXA6
         | 
| 111 | 
            +
                    Qm9keT48L3NvYXA6RW52ZWxvcGU+
         | 
| 112 | 
            +
                http_version: 
         | 
| 113 | 
            +
              recorded_at: Tue, 10 Feb 2015 12:50:38 GMT
         | 
| 114 | 
            +
            recorded_with: VCR 2.9.3
         | 
| @@ -1,251 +1,139 @@ | |
| 1 | 
            -
            require 'spec_helper'
         | 
| 2 | 
            -
             | 
| 3 1 | 
             
            RSpec.describe SoapyCake::Admin do
         | 
| 4 | 
            -
               | 
| 5 | 
            -
             | 
| 6 | 
            -
             | 
| 7 | 
            -
                    .to receive(:mark_affiliate_bill_as_received)
         | 
| 8 | 
            -
                    .with(affiliate_id: 2)
         | 
| 9 | 
            -
             | 
| 10 | 
            -
                  subject.affiliate_bill_received!(affiliate_id: 2)
         | 
| 11 | 
            -
                end
         | 
| 12 | 
            -
              end
         | 
| 2 | 
            +
              let(:opts) { { a: 1 } }
         | 
| 3 | 
            +
              let(:cake_opts) { opts }
         | 
| 4 | 
            +
              let(:cake_method) { method }
         | 
| 13 5 |  | 
| 14 | 
            -
               | 
| 15 | 
            -
                it ' | 
| 16 | 
            -
                   | 
| 17 | 
            -
             | 
| 18 | 
            -
                    .with( | 
| 6 | 
            +
              shared_examples_for 'a cake admin method' do
         | 
| 7 | 
            +
                it 'runs the request' do
         | 
| 8 | 
            +
                  request = double('request')
         | 
| 9 | 
            +
                  expect(SoapyCake::Request).to receive(:new)
         | 
| 10 | 
            +
                    .with(:admin, service, cake_method, cake_opts).and_return(request)
         | 
| 11 | 
            +
                  expect(subject).to receive(:run).with(request)
         | 
| 19 12 |  | 
| 20 | 
            -
                  subject. | 
| 13 | 
            +
                  subject.public_send(method, opts)
         | 
| 21 14 | 
             
                end
         | 
| 22 15 | 
             
              end
         | 
| 23 16 |  | 
| 24 | 
            -
              describe ' | 
| 25 | 
            -
                 | 
| 26 | 
            -
                  expect_any_instance_of(SoapyCake::Client::CakeClient)
         | 
| 27 | 
            -
                    .to receive(:export_advertiser_bills)
         | 
| 28 | 
            -
                    .with(advertiser_id: 2)
         | 
| 17 | 
            +
              describe 'accounting service' do
         | 
| 18 | 
            +
                let(:service) { :accounting }
         | 
| 29 19 |  | 
| 30 | 
            -
             | 
| 20 | 
            +
                describe '#affiliate_bills' do
         | 
| 21 | 
            +
                  let(:method) { :affiliate_bills }
         | 
| 22 | 
            +
                  let(:cake_method) { :export_affiliate_bills }
         | 
| 23 | 
            +
                  it_behaves_like 'a cake admin method'
         | 
| 31 24 | 
             
                end
         | 
| 32 | 
            -
              end
         | 
| 33 | 
            -
             | 
| 34 | 
            -
              describe '.campaign_summary' do
         | 
| 35 | 
            -
                let(:start_date) { Date.new(2014, 7, 1) }
         | 
| 36 | 
            -
                let(:end_date) { Date.new(2014, 7, 3) }
         | 
| 37 25 |  | 
| 38 | 
            -
                 | 
| 39 | 
            -
                   | 
| 40 | 
            -
             | 
| 41 | 
            -
             | 
| 42 | 
            -
                    .and_return('result')
         | 
| 43 | 
            -
             | 
| 44 | 
            -
                  expect(subject.campaign_summary(start_date: start_date, end_date: end_date, offer_id: 12))
         | 
| 45 | 
            -
                    .to eq('result')
         | 
| 26 | 
            +
                describe '#advertiser_bills' do
         | 
| 27 | 
            +
                  let(:method) { :advertiser_bills }
         | 
| 28 | 
            +
                  let(:cake_method) { :export_advertiser_bills }
         | 
| 29 | 
            +
                  it_behaves_like 'a cake admin method'
         | 
| 46 30 | 
             
                end
         | 
| 47 31 |  | 
| 48 | 
            -
                 | 
| 49 | 
            -
                   | 
| 50 | 
            -
             | 
| 51 | 
            -
                    .with(start_date: start_date, end_date: start_date + 1, offer_id: 12)
         | 
| 52 | 
            -
                    .and_return('result')
         | 
| 53 | 
            -
             | 
| 54 | 
            -
                  expect(subject.campaign_summary(start_date: start_date, offer_id: 12))
         | 
| 55 | 
            -
                    .to eq('result')
         | 
| 32 | 
            +
                describe '#mark_affiliate_bill_as_received' do
         | 
| 33 | 
            +
                  let(:method) { :mark_affiliate_bill_as_received }
         | 
| 34 | 
            +
                  it_behaves_like 'a cake admin method'
         | 
| 56 35 | 
             
                end
         | 
| 57 | 
            -
              end
         | 
| 58 36 |  | 
| 59 | 
            -
             | 
| 60 | 
            -
             | 
| 61 | 
            -
             | 
| 62 | 
            -
                  expect_any_instance_of(SoapyCake::Client::CakeClient)
         | 
| 63 | 
            -
                    .to receive(:advertisers)
         | 
| 64 | 
            -
             | 
| 65 | 
            -
                  subject.advertisers
         | 
| 37 | 
            +
                describe '#mark_affiliate_bill_as_paid' do
         | 
| 38 | 
            +
                  let(:method) { :mark_affiliate_bill_as_paid }
         | 
| 39 | 
            +
                  it_behaves_like 'a cake admin method'
         | 
| 66 40 | 
             
                end
         | 
| 67 41 | 
             
              end
         | 
| 68 42 |  | 
| 69 | 
            -
              describe ' | 
| 70 | 
            -
                 | 
| 71 | 
            -
                  expect_any_instance_of(SoapyCake::Client::CakeClient)
         | 
| 72 | 
            -
                    .to receive(:affiliates)
         | 
| 43 | 
            +
              describe 'export service' do
         | 
| 44 | 
            +
                let(:service) { :export }
         | 
| 73 45 |  | 
| 74 | 
            -
             | 
| 46 | 
            +
                describe '#advertisers' do
         | 
| 47 | 
            +
                  let(:method) { :advertisers }
         | 
| 48 | 
            +
                  it_behaves_like 'a cake admin method'
         | 
| 75 49 | 
             
                end
         | 
| 76 | 
            -
              end
         | 
| 77 50 |  | 
| 78 | 
            -
             | 
| 79 | 
            -
             | 
| 80 | 
            -
                   | 
| 81 | 
            -
                  expected = [{ ping: :pong }]
         | 
| 82 | 
            -
                  expect_any_instance_of(SoapyCake::Client::CakeClient)
         | 
| 83 | 
            -
                    .to receive(:campaigns)
         | 
| 84 | 
            -
                    .with(opts).and_return(expected)
         | 
| 85 | 
            -
                  expect(subject.campaigns(opts)).to eq(expected)
         | 
| 51 | 
            +
                describe '#affiliates' do
         | 
| 52 | 
            +
                  let(:method) { :affiliates }
         | 
| 53 | 
            +
                  it_behaves_like 'a cake admin method'
         | 
| 86 54 | 
             
                end
         | 
| 87 | 
            -
              end
         | 
| 88 55 |  | 
| 89 | 
            -
             | 
| 90 | 
            -
             | 
| 91 | 
            -
                   | 
| 92 | 
            -
                  expected = [{ ping: :pong }]
         | 
| 93 | 
            -
                  expect_any_instance_of(SoapyCake::Client::CakeClient)
         | 
| 94 | 
            -
                    .to receive(:offers)
         | 
| 95 | 
            -
                    .with(opts).and_return(expected)
         | 
| 96 | 
            -
                  expect(subject.offers(opts)).to eq(expected)
         | 
| 56 | 
            +
                describe '#campaigns' do
         | 
| 57 | 
            +
                  let(:method) { :campaigns }
         | 
| 58 | 
            +
                  it_behaves_like 'a cake admin method'
         | 
| 97 59 | 
             
                end
         | 
| 98 | 
            -
              end
         | 
| 99 60 |  | 
| 100 | 
            -
             | 
| 101 | 
            -
             | 
| 102 | 
            -
             | 
| 103 | 
            -
             | 
| 104 | 
            -
                it 'returns the affiliate summary report for the given days' do
         | 
| 105 | 
            -
                  expect_any_instance_of(SoapyCake::Client::CakeClient)
         | 
| 106 | 
            -
                    .to receive(:affiliate_summary)
         | 
| 107 | 
            -
                    .with(start_date: start_date, end_date: end_date).and_return(
         | 
| 108 | 
            -
                      [{ affiliate: { affiliate_id: '1' } },
         | 
| 109 | 
            -
                       { affiliate: { affiliate_id: '2' } }]
         | 
| 110 | 
            -
                  )
         | 
| 111 | 
            -
             | 
| 112 | 
            -
                  expect(subject.affiliate_summary(start_date: start_date, end_date: end_date))
         | 
| 113 | 
            -
                    .to eq(
         | 
| 114 | 
            -
                      [{ affiliate: { affiliate_id: '1' } },
         | 
| 115 | 
            -
                       { affiliate: { affiliate_id: '2' } }]
         | 
| 116 | 
            -
                    )
         | 
| 117 | 
            -
                end
         | 
| 118 | 
            -
             | 
| 119 | 
            -
                it 'returns the affiliate summary report for the start_date if no end_date is given' do
         | 
| 120 | 
            -
                  expect_any_instance_of(SoapyCake::Client::CakeClient)
         | 
| 121 | 
            -
                    .to receive(:affiliate_summary)
         | 
| 122 | 
            -
                    .with(start_date: start_date, end_date: start_date + 1).and_return(
         | 
| 123 | 
            -
                      [{ affiliate: { affiliate_id: '1' } },
         | 
| 124 | 
            -
                       { affiliate: { affiliate_id: '2' } }]
         | 
| 125 | 
            -
                    )
         | 
| 126 | 
            -
             | 
| 127 | 
            -
                  expect(subject.affiliate_summary(start_date: start_date)).to eq(
         | 
| 128 | 
            -
                    [{ affiliate: { affiliate_id: '1' } },
         | 
| 129 | 
            -
                     { affiliate: { affiliate_id: '2' } }]
         | 
| 130 | 
            -
                  )
         | 
| 61 | 
            +
                describe '#offers' do
         | 
| 62 | 
            +
                  let(:method) { :offers }
         | 
| 63 | 
            +
                  it_behaves_like 'a cake admin method'
         | 
| 131 64 | 
             
                end
         | 
| 132 | 
            -
              end
         | 
| 133 65 |  | 
| 134 | 
            -
             | 
| 135 | 
            -
             | 
| 136 | 
            -
             | 
| 137 | 
            -
             | 
| 138 | 
            -
                it 'returns the advertiser summary report for the given days' do
         | 
| 139 | 
            -
                  expect_any_instance_of(SoapyCake::Client::CakeClient)
         | 
| 140 | 
            -
                    .to receive(:advertiser_summary)
         | 
| 141 | 
            -
                    .with(start_date: start_date, end_date: end_date).and_return(
         | 
| 142 | 
            -
                      [{ advertiser: { advertiser_id: '1' } },
         | 
| 143 | 
            -
                       { advertiser: { advertiser_id: '2' } }]
         | 
| 144 | 
            -
                    )
         | 
| 145 | 
            -
             | 
| 146 | 
            -
                  expect(subject.advertiser_summary(start_date: start_date, end_date: end_date))
         | 
| 147 | 
            -
                    .to eq(
         | 
| 148 | 
            -
                      [{ advertiser: { advertiser_id: '1' } },
         | 
| 149 | 
            -
                       { advertiser: { advertiser_id: '2' } }]
         | 
| 150 | 
            -
                    )
         | 
| 151 | 
            -
                end
         | 
| 152 | 
            -
             | 
| 153 | 
            -
                it 'returns the advertiser summary report for the start_date if no end_date is given' do
         | 
| 154 | 
            -
                  expect_any_instance_of(SoapyCake::Client::CakeClient)
         | 
| 155 | 
            -
                    .to receive(:advertiser_summary)
         | 
| 156 | 
            -
                    .with(start_date: start_date, end_date: start_date + 1).and_return(
         | 
| 157 | 
            -
                      [{ advertiser: { advertiser_id: '1' } },
         | 
| 158 | 
            -
                       { advertiser: { advertiser_id: '2' } }]
         | 
| 159 | 
            -
                    )
         | 
| 160 | 
            -
             | 
| 161 | 
            -
                  expect(subject.advertiser_summary(start_date: start_date)).to eq(
         | 
| 162 | 
            -
                    [{ advertiser: { advertiser_id: '1' } },
         | 
| 163 | 
            -
                     { advertiser: { advertiser_id: '2' } }]
         | 
| 164 | 
            -
                  )
         | 
| 66 | 
            +
                describe '#creatives' do
         | 
| 67 | 
            +
                  let(:method) { :creatives }
         | 
| 68 | 
            +
                  it_behaves_like 'a cake admin method'
         | 
| 165 69 | 
             
                end
         | 
| 166 70 | 
             
              end
         | 
| 167 71 |  | 
| 168 | 
            -
              describe ' | 
| 169 | 
            -
                let(: | 
| 170 | 
            -
                let(:end_date) { Date.new(2014, 7, 3) }
         | 
| 72 | 
            +
              describe 'reports service' do
         | 
| 73 | 
            +
                let(:service) { :reports }
         | 
| 171 74 |  | 
| 172 | 
            -
                 | 
| 173 | 
            -
                   | 
| 174 | 
            -
             | 
| 175 | 
            -
                    .with(start_date: start_date, end_date: end_date, offer_id: 1)
         | 
| 176 | 
            -
                    .and_return('result')
         | 
| 177 | 
            -
             | 
| 178 | 
            -
                  expect(subject.offer_summary(start_date: start_date, end_date: end_date, offer_id: 1))
         | 
| 179 | 
            -
                    .to eq('result')
         | 
| 75 | 
            +
                describe '#campaign_summary' do
         | 
| 76 | 
            +
                  let(:method) { :campaign_summary }
         | 
| 77 | 
            +
                  it_behaves_like 'a cake admin method'
         | 
| 180 78 | 
             
                end
         | 
| 181 79 |  | 
| 182 | 
            -
                 | 
| 183 | 
            -
                   | 
| 184 | 
            -
             | 
| 185 | 
            -
                    .with(start_date: start_date, end_date: start_date + 1, offer_id: 1)
         | 
| 186 | 
            -
                    .and_return('result')
         | 
| 187 | 
            -
             | 
| 188 | 
            -
                  expect(subject.offer_summary(start_date: start_date, offer_id: 1))
         | 
| 189 | 
            -
                    .to eq('result')
         | 
| 80 | 
            +
                describe '#offer_summary' do
         | 
| 81 | 
            +
                  let(:method) { :offer_summary }
         | 
| 82 | 
            +
                  it_behaves_like 'a cake admin method'
         | 
| 190 83 | 
             
                end
         | 
| 191 | 
            -
              end
         | 
| 192 84 |  | 
| 193 | 
            -
             | 
| 194 | 
            -
             | 
| 195 | 
            -
                   | 
| 196 | 
            -
             | 
| 197 | 
            -
                    .with(color: 'green', conversion_type: 'conversions')
         | 
| 85 | 
            +
                describe '#affiliate_summary' do
         | 
| 86 | 
            +
                  let(:method) { :affiliate_summary }
         | 
| 87 | 
            +
                  it_behaves_like 'a cake admin method'
         | 
| 88 | 
            +
                end
         | 
| 198 89 |  | 
| 199 | 
            -
             | 
| 90 | 
            +
                describe '#advertiser_summary' do
         | 
| 91 | 
            +
                  let(:method) { :advertiser_summary }
         | 
| 92 | 
            +
                  it_behaves_like 'a cake admin method'
         | 
| 200 93 | 
             
                end
         | 
| 201 | 
            -
              end
         | 
| 202 94 |  | 
| 203 | 
            -
             | 
| 204 | 
            -
             | 
| 205 | 
            -
                   | 
| 206 | 
            -
             | 
| 207 | 
            -
                    .with(color: 'red', conversion_type: 'events')
         | 
| 95 | 
            +
                describe '#clicks' do
         | 
| 96 | 
            +
                  let(:method) { :clicks }
         | 
| 97 | 
            +
                  it_behaves_like 'a cake admin method'
         | 
| 98 | 
            +
                end
         | 
| 208 99 |  | 
| 209 | 
            -
             | 
| 100 | 
            +
                describe '#conversions' do
         | 
| 101 | 
            +
                  let(:method) { :conversions }
         | 
| 102 | 
            +
                  let(:cake_opts) { opts.merge(conversion_type: 'conversions') }
         | 
| 103 | 
            +
                  it_behaves_like 'a cake admin method'
         | 
| 210 104 | 
             
                end
         | 
| 211 | 
            -
              end
         | 
| 212 105 |  | 
| 213 | 
            -
             | 
| 214 | 
            -
             | 
| 215 | 
            -
                   | 
| 216 | 
            -
             | 
| 217 | 
            -
                   | 
| 106 | 
            +
                describe '#events' do
         | 
| 107 | 
            +
                  let(:method) { :events }
         | 
| 108 | 
            +
                  let(:cake_method) { :conversions }
         | 
| 109 | 
            +
                  let(:cake_opts) { opts.merge(conversion_type: 'events') }
         | 
| 110 | 
            +
                  it_behaves_like 'a cake admin method'
         | 
| 218 111 | 
             
                end
         | 
| 219 | 
            -
              end
         | 
| 220 112 |  | 
| 221 | 
            -
             | 
| 222 | 
            -
             | 
| 223 | 
            -
                   | 
| 224 | 
            -
             | 
| 225 | 
            -
                    .with(offer_id: 1)
         | 
| 226 | 
            -
                  subject.creatives(offer_id: 1)
         | 
| 113 | 
            +
                describe '#traffic' do
         | 
| 114 | 
            +
                  let(:method) { :traffic }
         | 
| 115 | 
            +
                  let(:cake_method) { :traffic_export }
         | 
| 116 | 
            +
                  it_behaves_like 'a cake admin method'
         | 
| 227 117 | 
             
                end
         | 
| 228 118 | 
             
              end
         | 
| 229 119 |  | 
| 230 | 
            -
              describe ' | 
| 231 | 
            -
                let(: | 
| 232 | 
            -
                let(:end_date) { Date.new(2014, 7, 3) }
         | 
| 233 | 
            -
             | 
| 234 | 
            -
                it 'fetches a traffic report' do
         | 
| 235 | 
            -
                  expect_any_instance_of(SoapyCake::Client::CakeClient)
         | 
| 236 | 
            -
                    .to receive(:traffic_export)
         | 
| 237 | 
            -
                    .with(start_date: start_date, end_date: end_date)
         | 
| 120 | 
            +
              describe 'get service' do
         | 
| 121 | 
            +
                let(:service) { :get }
         | 
| 238 122 |  | 
| 239 | 
            -
             | 
| 123 | 
            +
                describe '#currencies' do
         | 
| 124 | 
            +
                  let(:method) { :currencies }
         | 
| 125 | 
            +
                  let(:cake_opts) { {} }
         | 
| 126 | 
            +
                  it_behaves_like 'a cake admin method'
         | 
| 240 127 | 
             
                end
         | 
| 241 128 | 
             
              end
         | 
| 242 129 |  | 
| 243 | 
            -
              describe ' | 
| 244 | 
            -
                 | 
| 245 | 
            -
                  expect_any_instance_of(SoapyCake::Client::CakeClient).to receive(:creative)
         | 
| 246 | 
            -
                    .with(offer_id: 1, creative_status_id: 1)
         | 
| 130 | 
            +
              describe 'addedit service' do
         | 
| 131 | 
            +
                let(:service) { :addedit }
         | 
| 247 132 |  | 
| 248 | 
            -
             | 
| 133 | 
            +
                describe '#update_creative' do
         | 
| 134 | 
            +
                  let(:method) { :update_creative }
         | 
| 135 | 
            +
                  let(:cake_method) { :creative }
         | 
| 136 | 
            +
                  it_behaves_like 'a cake admin method'
         | 
| 249 137 | 
             
                end
         | 
| 250 138 | 
             
              end
         | 
| 251 139 | 
             
            end
         |