soapy_cake 1.18.1 → 1.19.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8e26334b985438b122e18a8920d337c52c75df00
4
- data.tar.gz: 87b705e0cad9950e755b8314e6807e0ca10bdf2b
3
+ metadata.gz: 1b885bb4fe2f48d057406017f66cb421de417619
4
+ data.tar.gz: c1d0e66a52f0b4acff03760ddcf9f94ef0da7f37
5
5
  SHA512:
6
- metadata.gz: 72ff5aa1e53282ec3eeec540adf9a420efcc990c260f741482ff14fdebc40040e7b66a689785c0adc19e0cc4de757ffb84b8f6f138d2eaf8f3fa48b35de44d52
7
- data.tar.gz: 4844628f5036fbfec04bc5a3037dd38e5817b5da11e0c794a2a0f43c42abf957d57710bcef4a575b967ea688bc437900c7e68f7eca9830c19069e7ab0f898892
6
+ metadata.gz: 39f8963dd4d26fc38edec8478ce6b5e17af70d3c62a724fc4eb6814625f0fb5ed386e0e3f30793b64dafc18db6cf42bc4cdf6a7b8767f894f2345ea42cbbf65e
7
+ data.tar.gz: 8f2f6de99f031f2b5869ec82cbf02426996ea1047b1f17e6aa309579dba615a894bb3d0e2504e3d8e517cd9fae72559e9ab35b95ccb6f80d9c2ba580a4de9910
data/lib/soapy_cake.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require 'logger'
1
2
  require 'nokogiri'
2
3
  require 'saxerator'
3
4
  require 'httparty'
@@ -19,7 +19,7 @@ module SoapyCake
19
19
 
20
20
  protected
21
21
 
22
- attr_reader :domain, :api_key, :time_converter, :opts
22
+ attr_reader :domain, :api_key, :time_converter, :opts, :logger
23
23
 
24
24
  def run(request)
25
25
  request.api_key = api_key
@@ -31,11 +31,17 @@ module SoapyCake
31
31
 
32
32
  private
33
33
 
34
+ def logger
35
+ @logger ||= opts[:logger] || (defined?(::Rails) && ::Rails.logger)
36
+ end
37
+
34
38
  def response_body(request)
35
39
  request.opts[:response].presence || http_response(request)
36
40
  end
37
41
 
38
42
  def http_response(request)
43
+ logger.info("soapy_cake:request #{request}") if logger
44
+
39
45
  url = "https://#{domain}#{request.path}"
40
46
  http_response = HTTParty.post(url, headers: HEADERS, body: request.xml, timeout: NET_TIMEOUT)
41
47
 
@@ -33,6 +33,10 @@ module SoapyCake
33
33
  %w(addedit track signup).include?(service)
34
34
  end
35
35
 
36
+ def to_s
37
+ "#{role}:#{service}:#{method}:#{version} #{opts.to_json}"
38
+ end
39
+
36
40
  private
37
41
 
38
42
  def api_path
@@ -1,3 +1,3 @@
1
1
  module SoapyCake
2
- VERSION = '1.18.1'.freeze
2
+ VERSION = '1.19.0'.freeze
3
3
  end
@@ -1,7 +1,15 @@
1
1
  RSpec.describe SoapyCake::Admin do
2
2
  around { |example| Timecop.freeze(Time.utc(2015, 6, 15, 12), &example) }
3
3
 
4
+ let(:logger) { double('logger') }
5
+ before { allow(logger).to receive(:info) }
6
+
7
+ subject { described_class.new(logger: logger) }
8
+
4
9
  it 'returns an affiliate with correct data types', :vcr do
10
+ expect(logger).to receive(:info)
11
+ .with('soapy_cake:request admin:export:affiliates:5 {"affiliate_id":16027}')
12
+
5
13
  result = subject.affiliates(affiliate_id: 16027)
6
14
  expect(result.count).to eq(1)
7
15
  expect(result.first).to include(
@@ -125,8 +133,10 @@ RSpec.describe SoapyCake::Admin do
125
133
  advertiser: { advertiser_id: 15882, advertiser_name: ' NetDragon Websoft Inc. ' },
126
134
  affiliate: { affiliate_id: 16187, affiliate_name: 'Illuminati Corp.' },
127
135
  blacklist_id: 202,
128
- blacklist_reason: { blacklist_reason_id: 5,
129
- blacklist_reason_name: 'Fraud - suspicious user-data' },
136
+ blacklist_reason: {
137
+ blacklist_reason_id: 5,
138
+ blacklist_reason_name: 'Fraud - suspicious user-data'
139
+ },
130
140
  blacklist_type: { blacklist_type_id: 1, blacklist_type_name: 'Global Redirect' },
131
141
  date_created: Time.utc(2015, 9, 22, 22),
132
142
  offer: { offer_id: 10551, offer_name: 'DO NOT USE: Foxy Test 42 (AD DOI)' },
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.18.1
4
+ version: 1.19.0
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-10-30 00:00:00.000000000 Z
11
+ date: 2015-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport