affiliate_window 0.0.1 → 0.1.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/README.md +13 -0
- data/lib/affiliate_window/base.rb +11 -1
- data/lib/affiliate_window/client.rb +1 -0
- data/lib/affiliate_window/parser.rb +7 -0
- data/lib/affiliate_window/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f599f12f683a8242dc1e001853e42ed561102f8
|
4
|
+
data.tar.gz: c1d5e58a250b962fe56aa559e12afbcdb19d26eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f57cd4ef2d9c07c0981eec18375789c3343fcbb5286ce661d7c390480ce8ec735bca2b4005767e3e7084aa44cebab56353b6959864581816e5e82c2b554f5f8
|
7
|
+
data.tar.gz: 10b9264d5c7c972bfbc6c13f4af6e7dfaa059512712a7d558b1fcc9ea29cafa614782af57d597bab69cbdfed56f0ae17cb73881ea111a6f1b530684a2637ddd9
|
data/README.md
CHANGED
@@ -55,6 +55,19 @@ response
|
|
55
55
|
# }
|
56
56
|
```
|
57
57
|
|
58
|
+
## Quota
|
59
|
+
|
60
|
+
The API provides a daily quota of 15,000 requests per account. The remaining
|
61
|
+
quota is returned in the header of each response. If this quota is reached,
|
62
|
+
subsequent requests to the API will raise errors.
|
63
|
+
|
64
|
+
You can check the remaining quota with:
|
65
|
+
|
66
|
+
```ruby
|
67
|
+
client.remaining_quota
|
68
|
+
#=> 14997
|
69
|
+
```
|
70
|
+
|
58
71
|
## Debugging
|
59
72
|
|
60
73
|
You can print the SOAP request bodies by enabling debug mode:
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# http://wiki.affiliatewindow.com/index.php/Publisher_Service_API
|
3
3
|
|
4
4
|
class AffiliateWindow
|
5
|
-
attr_accessor :client, :error_handler, :parser, :debug
|
5
|
+
attr_accessor :client, :error_handler, :parser, :debug, :remaining_quota
|
6
6
|
|
7
7
|
def self.login(account_id:, affiliate_api_password:)
|
8
8
|
client = Client.new(
|
@@ -114,6 +114,12 @@ class AffiliateWindow
|
|
114
114
|
)
|
115
115
|
end
|
116
116
|
|
117
|
+
def remaining_quota
|
118
|
+
@remaining_quota || raise(UnknownQuotaError,
|
119
|
+
"No requests have been made, so the remaining quota is unknown."
|
120
|
+
)
|
121
|
+
end
|
122
|
+
|
117
123
|
private
|
118
124
|
|
119
125
|
def call(method, params)
|
@@ -123,10 +129,14 @@ class AffiliateWindow
|
|
123
129
|
client.call(method, params, debug)
|
124
130
|
end
|
125
131
|
|
132
|
+
self.remaining_quota = parser.parse_quota(response)
|
133
|
+
|
126
134
|
parser.parse(response, method)
|
127
135
|
end
|
128
136
|
|
129
137
|
def remove_nils(params)
|
130
138
|
params.reject { |_, value| value.nil? }
|
131
139
|
end
|
140
|
+
|
141
|
+
class UnknownQuotaError < StandardError; end
|
132
142
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: affiliate_window
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Reevoo Developers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: savon
|