soapy_cake 0.2.10 → 0.2.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9b53508bd3216bab78655097a29155c363dcd40c
4
- data.tar.gz: 307e42a79a8dfe66a984ad27eef27548befa0bf4
3
+ metadata.gz: 172799dd2442d0b285158f587fb3a70ab54a05ea
4
+ data.tar.gz: 684567c43579a023b8d408e5eb29859215f26e7d
5
5
  SHA512:
6
- metadata.gz: edb5178d36653d29c321fa3b28b1abc5637942aa63d9f0159b6e4f7abc768a946ec736437d8ccc8a8464530a99f55731f0e806970ac3745f94aa7880ffb8e470
7
- data.tar.gz: 8ba791b73e73e10b8da57bad9d3e87e3407248a1103006104dfbb717a10ea7fdcc7004cce6ea3359f8aae7be6458656cdb5d7cf0c3d8b7cc8c0dd7697cc4c81e
6
+ metadata.gz: 6f1d407df28dccb1b122c451c5bd6c7419bb705c50340dd5674a25b307e242445162830964d1e31cefc02392b0ccd5b82ae968782e152dc085f56463c591834e
7
+ data.tar.gz: 160f50baa20286cd3b5ea01749f4fbd7a46bae8414e703c5e0b00d3e512f9bde5ef2bb479dd419d698162d7d31ded909e68ece27d911c3bb76bcee511dae6f9d
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  [![Test Coverage](https://codeclimate.com/github/ad2games/soapy_cake/coverage.png)](https://codeclimate.com/github/ad2games/soapy_cake)
4
4
  [![Gem Version](http://img.shields.io/gem/v/soapy_cake.svg)](http://rubygems.org/gems/soapy_cake)
5
5
  [![Dependency Status](http://img.shields.io/gemnasium/ad2games/soapy_cake.svg)](https://gemnasium.com/ad2games/soapy_cake)
6
- [![Build Status](https://circleci.com/gh/ad2games/soapy_cake.png?circle-token=aac691804f58acd8e96db632f8133e3c6155f123)](https://circleci.com/gh/ad2games/soapy_cake)
6
+ [![Circle CI](https://circleci.com/gh/ad2games/soapy_cake.png?style=shield&circle-token=aac691804f58acd8e96db632f8133e3c6155f123)](https://circleci.com/gh/ad2games/soapy_cake)
7
7
 
8
8
  Simple client library for [cake](http://getcake.com).
9
9
 
@@ -1,5 +1,6 @@
1
1
  require 'sekken'
2
2
  require 'active_support/core_ext/time/zones'
3
+ require 'local_copy'
3
4
 
4
5
  module SoapyCake
5
6
  class Client
@@ -14,7 +15,7 @@ module SoapyCake
14
15
  if ENV['CAKE_DOMAIN'].present?
15
16
  ENV['CAKE_DOMAIN']
16
17
  else
17
- raise 'We need a domain'
18
+ fail 'We need a domain'
18
19
  end
19
20
  end
20
21
 
@@ -24,7 +25,7 @@ module SoapyCake
24
25
  elsif ENV['CAKE_API_KEY']
25
26
  ENV['CAKE_API_KEY']
26
27
  else
27
- raise 'We need an API key here!'
28
+ fail 'We need an API key here!'
28
29
  end
29
30
  end
30
31
  end
@@ -38,8 +39,9 @@ module SoapyCake
38
39
  end
39
40
 
40
41
  def self.sekken_client(url)
42
+ path = LocalCopy.fetch(url)
41
43
  @sekken_clients ||= {}
42
- @sekken_clients[url] ||= Sekken.new(url)
44
+ @sekken_clients[url] ||= Sekken.new(path)
43
45
  end
44
46
 
45
47
  def method_missing(method, opts = {})
@@ -84,7 +86,7 @@ module SoapyCake
84
86
 
85
87
  def process_response(method, response)
86
88
  Time.use_zone('UTC') do
87
- raise RequestUnsuccessful, response[:fault][:reason][:text] if response[:fault]
89
+ fail RequestUnsuccessful, response[:fault][:reason][:text] if response[:fault]
88
90
  node_name = {
89
91
  'affiliate_summary' => 'affiliates',
90
92
  'advertiser_summary' => 'advertisers',
@@ -97,10 +99,10 @@ module SoapyCake
97
99
  }.fetch(method, method)
98
100
 
99
101
  result = response[:"#{method}_response"][:"#{method}_result"]
100
- raise RequestUnsuccessful, result[:message] if result[:success] == false
102
+ fail RequestUnsuccessful, result[:message] if result[:success] == false
101
103
  return result unless result_has_collection?(result, method)
102
- extract_collection(node_name, result).
103
- map { |hash| remove_prefix(node_name, hash) }
104
+ extract_collection(node_name, result)
105
+ .map { |hash| remove_prefix(node_name, hash) }
104
106
  end
105
107
  end
106
108
 
@@ -1,3 +1,3 @@
1
1
  module SoapyCake
2
- VERSION = '0.2.10'
2
+ VERSION = '0.2.11'
3
3
  end
data/soapy_cake.gemspec CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
8
8
  spec.version = SoapyCake::VERSION
9
9
  spec.authors = ['ad2games GmbH']
10
10
  spec.email = ['developers@ad2games.com']
11
- spec.summary = %q{Simple client for the CAKE API}
12
- spec.description = %q{Simple client for the CAKE API (http://getcake.com)}
11
+ spec.summary = 'Simple client for the CAKE API'
12
+ spec.description = 'Simple client for the CAKE API (http://getcake.com)'
13
13
  spec.homepage = 'http://ad2games.com'
14
14
  spec.license = 'MIT'
15
15
 
@@ -20,6 +20,7 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_dependency 'activesupport'
22
22
  spec.add_dependency 'sekken'
23
+ spec.add_dependency 'local_copy'
23
24
 
24
25
  spec.add_development_dependency 'bundler'
25
26
  spec.add_development_dependency 'rake'
@@ -173,20 +173,18 @@ describe SoapyCake::Client do
173
173
  end
174
174
 
175
175
  it 'raises RequestUnsuccessful if response contains success: false' do
176
- expect {
177
- client.send(:process_response, :affiliate, {
178
- affiliate_response: {
179
- affiliate_result: { message: 'FAIL!', success: false }
180
- }
181
- })
182
- }.to raise_error(SoapyCake::Client::RequestUnsuccessful, 'FAIL!')
176
+ expect do
177
+ client.send(:process_response, :affiliate, affiliate_response: {
178
+ affiliate_result: { message: 'FAIL!', success: false }
179
+ })
180
+ end.to raise_error(SoapyCake::Client::RequestUnsuccessful, 'FAIL!')
183
181
  end
184
182
 
185
183
  it 'raises RequestUnsuccessful if response contains `:fault` key' do
186
- expect {
184
+ expect do
187
185
  client.send(:process_response, :affiliate,
188
- { fault: { reason: { text: 'FAIL!' }}})
189
- }.to raise_error(SoapyCake::Client::RequestUnsuccessful, 'FAIL!')
186
+ fault: { reason: { text: 'FAIL!' } })
187
+ end.to raise_error(SoapyCake::Client::RequestUnsuccessful, 'FAIL!')
190
188
  end
191
189
  end
192
190
 
data/spec/spec_helper.rb CHANGED
@@ -1,4 +1,4 @@
1
- require "codeclimate-test-reporter"
1
+ require 'codeclimate-test-reporter'
2
2
  CodeClimate::TestReporter.start
3
3
  require 'bundler/setup'
4
4
  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: 0.2.10
4
+ version: 0.2.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - ad2games GmbH
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-09 00:00:00.000000000 Z
11
+ date: 2014-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: local_copy
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: bundler
43
57
  requirement: !ruby/object:Gem::Requirement