datasift 1.4.1 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/README.md +2 -0
- data/VERSION +1 -1
- data/lib/DataSift/user.rb +5 -0
- data/test/test_user.rb +20 -1
- metadata +5 -5
data/.gitignore
CHANGED
data/README.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.5.0
|
data/lib/DataSift/user.rb
CHANGED
@@ -63,6 +63,11 @@ module DataSift
|
|
63
63
|
StreamConsumer.factory(self, type, Definition.new(self, nil, hash))
|
64
64
|
end
|
65
65
|
|
66
|
+
# Returns the account balance information for this user.
|
67
|
+
def getBalance
|
68
|
+
callAPI('balance')['balance']
|
69
|
+
end
|
70
|
+
|
66
71
|
# Returns the usage data for this user. If a hash is provided then a more
|
67
72
|
# detailed breakdown using interaction types is retrieved and returned.
|
68
73
|
# === Parameters
|
data/test/test_user.rb
CHANGED
@@ -64,7 +64,26 @@ class TestUser < Test::Unit::TestCase
|
|
64
64
|
assert_not_nil @definition
|
65
65
|
assert_equal @testdata['definition'], @definition.csdl
|
66
66
|
end
|
67
|
-
|
67
|
+
end
|
68
|
+
|
69
|
+
context "#getBalance" do
|
70
|
+
setup do
|
71
|
+
init()
|
72
|
+
initUser()
|
73
|
+
@user.api_client.setResponse(200, {
|
74
|
+
'balance' => {
|
75
|
+
'plan' => 'payg',
|
76
|
+
'credit' => 206.74
|
77
|
+
}
|
78
|
+
}, 200, 150)
|
79
|
+
end
|
80
|
+
|
81
|
+
should "return a hash containing the account balance info" do
|
82
|
+
@usage_hash = @user.getBalance()
|
83
|
+
assert @usage_hash['plan'] == 'payg'
|
84
|
+
assert @usage_hash['credit'] == 206.74
|
85
|
+
end
|
86
|
+
end
|
68
87
|
|
69
88
|
context "Given a call has been made to the API" do
|
70
89
|
setup do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: datasift
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 3
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 1.
|
8
|
+
- 5
|
9
|
+
- 0
|
10
|
+
version: 1.5.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- DataSift
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-05-
|
18
|
+
date: 2012-05-24 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rest-client
|