sift-partner 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sift-partner/client.rb +8 -5
- data/lib/sift-partner/version.rb +1 -1
- data/spec/unit/client_spec.rb +23 -3
- 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: 7987ee5a58921058cdbb5c708746f0eda484d770
|
4
|
+
data.tar.gz: a061b87759f04a37665174eb55a73423fb1fc178
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0b58bb159cb059d76f28d14d0a0a683620016a387917a70cd9f79f6bb3ab665e34f972178aec977b42a0f91e0f6adf91d52c286f012a95f37e6e7e6972539d8
|
7
|
+
data.tar.gz: c80cd09c8a11e70a7ce0421ed4ff001fdc0575475400bc4aec1cd2dd7c0a98c07bf39e59bf28d9487f4c856125140bc22dcc3ca448010536fb736e3180741737
|
data/lib/sift-partner/client.rb
CHANGED
@@ -59,14 +59,17 @@ module SiftPartner
|
|
59
59
|
|
60
60
|
end
|
61
61
|
|
62
|
-
# Gets a listing of the ids and keys for
|
63
|
-
# been created by this partner.
|
62
|
+
# Gets a listing of the ids and keys for merchant accounts that have
|
63
|
+
# been created by this partner. This will return up to 100 results
|
64
|
+
# at a time.
|
64
65
|
#
|
65
66
|
# When successful, returns a hash including the key :data, which is an
|
66
67
|
# array of account descriptions. (Each element has the same structure as a
|
67
|
-
# single response from new_account).
|
68
|
-
|
69
|
-
|
68
|
+
# single response from new_account). If the key :has_more is true, then
|
69
|
+
# pass the :next_ref value into this function again to get the next set
|
70
|
+
# of results.
|
71
|
+
def get_accounts(next_ref = nil)
|
72
|
+
http_get(next_ref ? next_ref : accounts_url)
|
70
73
|
end
|
71
74
|
|
72
75
|
# Updates the configuration which controls http notifications for all merchant
|
data/lib/sift-partner/version.rb
CHANGED
data/spec/unit/client_spec.rb
CHANGED
@@ -123,20 +123,40 @@ describe SiftPartner::Client do
|
|
123
123
|
end
|
124
124
|
|
125
125
|
it "should march through account listing flow" do
|
126
|
-
stub_request(:get, /https:\/\/.*partner\.siftscience\.com\/v3\/partners\/#{partner_id}\/accounts/).
|
126
|
+
stub_request(:get, /https:\/\/.*partner\.siftscience\.com\/v3\/partners\/#{partner_id}\/accounts\z/).
|
127
|
+
to_return(
|
128
|
+
{:body =>
|
129
|
+
{ "type" => "partner_account", "data" => [expected_account_body.to_json],
|
130
|
+
"hasMore" => true,
|
131
|
+
"nextRef" => "https://partner.siftscience.com/v3/partners/#{partner_id}/accounts?afterId=1234567890abcdef",
|
132
|
+
"totalResults" => 2}.to_json,
|
133
|
+
:status => 200,
|
134
|
+
:headers => {}}
|
135
|
+
)
|
136
|
+
expected_account_body["account_id"] = "1234567890abcdff"
|
137
|
+
stub_request(:get, /https:\/\/.*partner\.siftscience\.com\/v3\/partners\/#{partner_id}\/accounts\?afterId=1234567890abcdef/).
|
127
138
|
to_return(
|
128
139
|
{:body =>
|
129
140
|
{ "type" => "partner_account", "data" => [expected_account_body.to_json],
|
130
141
|
"hasMore" => false,
|
131
142
|
"nextRef" => nil,
|
132
|
-
"totalResults" =>
|
143
|
+
"totalResults" => 2}.to_json,
|
133
144
|
:status => 200,
|
134
145
|
:headers => {}}
|
135
146
|
)
|
136
147
|
partner_client = SiftPartner::Client.new(partner_api_key, partner_id)
|
137
148
|
response = partner_client.get_accounts()
|
138
149
|
response.should_not be_nil
|
139
|
-
response["
|
150
|
+
response["nextRef"].should_not be_nil
|
151
|
+
response["hasMore"].should be_truthy
|
152
|
+
response["totalResults"].should eq(2)
|
153
|
+
next_ref = response["nextRef"]
|
154
|
+
|
155
|
+
response = partner_client.get_accounts(next_ref)
|
156
|
+
response.should_not be_nil
|
157
|
+
response["hasMore"].should be_falsey
|
158
|
+
response["nextRef"].should be_nil
|
159
|
+
response["totalResults"].should eq(2)
|
140
160
|
end
|
141
161
|
|
142
162
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sift-partner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Beppu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|