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 CHANGED
@@ -1,2 +1,3 @@
1
1
  .DS_Store
2
2
  sftp-config.json
3
+ .idea/
data/README.md CHANGED
@@ -56,6 +56,8 @@ more details.
56
56
  Changelog
57
57
  ---------
58
58
 
59
+ * v.1.5.0 Added getBalance to the User class [joncooper] (2012-05-24)
60
+
59
61
  * v.1.4.1 Fixed a minor bug in the SSL support (2012-05-15)
60
62
 
61
63
  * v.1.4.0 Added SSL support (2012-05-15)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.4.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
- end
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: 5
4
+ hash: 3
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 4
9
- - 1
10
- version: 1.4.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-15 00:00:00 Z
18
+ date: 2012-05-24 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rest-client