quanto-ruby 0.0.16 → 0.0.17
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 +50 -10
- data/lib/quanto/client.rb +1 -1
- data/lib/quanto/version.rb +1 -1
- data/spec/quanto_client_spec.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: e07a8c9fabe39d67a1e2387f58820c20901a1d0c
|
4
|
+
data.tar.gz: 6bb185d1c3b7e8a9d373da65dc4d3a4d793e560f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6ad8460d627d1a322a6d015edcc88b033d85ae331049096c3c3ab0f1aeaad5aa6a2402948730258f8684257a60cb9d5465ba2fc8b32743b3e7aa2c7781ad9dc
|
7
|
+
data.tar.gz: 2c4a2c30ff04624b59e8f4cda678c92ea0829ede57bc17e71e77074dddc65215eb9d646321cb924034bf96a4096a19e117ac398794b87cc7eefd2da4a1d69834
|
data/README.md
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
# Quanto::Ruby
|
2
2
|
|
3
|
-
TODO: Write a gem description
|
4
|
-
|
5
3
|
## Installation
|
6
4
|
|
7
5
|
Add this line to your application's Gemfile:
|
@@ -16,14 +14,56 @@ Or install it yourself as:
|
|
16
14
|
|
17
15
|
$ gem install quanto-ruby
|
18
16
|
|
19
|
-
##
|
17
|
+
## Documentation
|
18
|
+
|
19
|
+
This gem is a simple OAuth client for Quanto.
|
20
|
+
Most of the logic is handled by the underlying OAuth2 library, so this gem is simply a wrapper around authenticated API calls.
|
21
|
+
|
22
|
+
To get started, you can create a client like this:
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
client = Quanto::Client.new(ENV['QUANTO_KEY'], ENV['QUANTO_SECRET'], access_token: 'my token')
|
26
|
+
```
|
27
|
+
|
28
|
+
where `'my_token'` should be your actual access token. Once you have a `Client`, you have access to the following methods:
|
29
|
+
|
30
|
+
- `#record_entry(value, metric_name, options={})`
|
31
|
+
|
32
|
+
This method records an entry for the given metric in Quanto.
|
33
|
+
The optional third argument lets the user specify a date, but the default is today.
|
34
|
+
For instance, the following call would record 20 steps for today:
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
client.record_entry(20, :steps)
|
38
|
+
```
|
39
|
+
|
40
|
+
while this call would record 137 pushups for April 1st 2013.
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
client.record_entry(137, :pushups, date: '2013-04-01')
|
44
|
+
```
|
45
|
+
|
46
|
+
- `#plugin_url`
|
47
|
+
|
48
|
+
Returns the URL of this plugin on Quanto.
|
49
|
+
Useful when redirecting the user after authenticating.
|
50
|
+
|
51
|
+
- `#activate_plugin`
|
52
|
+
|
53
|
+
Activates the plugin in Quanto.
|
54
|
+
This should be called whenever the plugin has successfully obtained all 3rd party credentials and is ready to send data.
|
20
55
|
|
21
|
-
|
56
|
+
- `#metrics`
|
22
57
|
|
23
|
-
|
58
|
+
Returns a list of metrics enabled for the current plugin of the following format:
|
24
59
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
60
|
+
```ruby
|
61
|
+
[{
|
62
|
+
'name' => 'steps',
|
63
|
+
'metric_type' => 'count',
|
64
|
+
},
|
65
|
+
{
|
66
|
+
'name' => 'sleep',
|
67
|
+
'metric_type' => 'minutes',
|
68
|
+
}]
|
69
|
+
```
|
data/lib/quanto/client.rb
CHANGED
data/lib/quanto/version.rb
CHANGED
data/spec/quanto_client_spec.rb
CHANGED
@@ -23,7 +23,7 @@ describe Quanto::Client do
|
|
23
23
|
|
24
24
|
it 'passes the quanto URL' do
|
25
25
|
expect(OAuth2::Client).to receive(:new) do |key, secret, options|
|
26
|
-
expect(options[:site]).to eq('http://
|
26
|
+
expect(options[:site]).to eq('http://quanto.herokuapp.com')
|
27
27
|
end
|
28
28
|
Quanto::Client.new(consumer_key, consumer_secret)
|
29
29
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quanto-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rasmus Rygaard
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oauth2
|