quanto-ruby 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/quanto/client.rb +0 -1
- data/lib/quanto/metrics.rb +7 -2
- data/lib/quanto/version.rb +1 -1
- data/quanto-ruby.gemspec +1 -1
- data/spec/quanto_client_spec.rb +11 -9
- 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: 50ca6459ee9dd8c1d65e57e93a8ef205b7865b73
|
4
|
+
data.tar.gz: 1940e1fcbb46cf452211f1d8c9f641b1ff4c3cc7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: afc149c898889d2bcc60259023a6279820a0062041562d3aab2c23acab7408d359c067ebf7fdf17ce9f8a5b341190ef2e6203dc11f512afc7d20081ad36efa07
|
7
|
+
data.tar.gz: a1bae7dd41f4ec07aa577d9831fea9f9d16db2042cc6949b93730229cd7f4c85a909d76775389848978c90001e6f614ecec6f6993e3ea5544819fc713ad60501
|
data/lib/quanto/client.rb
CHANGED
data/lib/quanto/metrics.rb
CHANGED
@@ -2,8 +2,13 @@ module Quanto
|
|
2
2
|
|
3
3
|
class Client
|
4
4
|
|
5
|
-
def record_metric(value, type)
|
6
|
-
|
5
|
+
def record_metric(value, type, opts={})
|
6
|
+
metric = {
|
7
|
+
metric_type: type,
|
8
|
+
value: value,
|
9
|
+
date: opts[:date] || Date.today.to_s
|
10
|
+
}
|
11
|
+
post('/metrics', metric: metric)
|
7
12
|
end
|
8
13
|
|
9
14
|
end
|
data/lib/quanto/version.rb
CHANGED
data/quanto-ruby.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["rasmus@rasmusrygaard.com"]
|
11
11
|
spec.description = %q{This gem acts as an API wrapper for the quanto quantified self application.}
|
12
12
|
spec.summary = %q{a Ruby API for quanto}
|
13
|
-
spec.homepage = ""
|
13
|
+
spec.homepage = "https://github.com/rasmusrygaard/quanto-ruby"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files`.split($/)
|
data/spec/quanto_client_spec.rb
CHANGED
@@ -8,18 +8,18 @@ describe Quanto::Client do
|
|
8
8
|
|
9
9
|
describe '#initialize' do
|
10
10
|
|
11
|
-
it 'constructs an
|
12
|
-
|
11
|
+
it 'constructs an OAuth2 consumer' do
|
12
|
+
OAuth2::Client.should_receive(:new)
|
13
13
|
Quanto::Client.new(consumer_key, consumer_secret)
|
14
14
|
end
|
15
15
|
|
16
16
|
it 'passes consumer credentials' do
|
17
|
-
|
17
|
+
OAuth2::Client.should_receive(:new).with(consumer_key, consumer_secret, anything)
|
18
18
|
Quanto::Client.new(consumer_key, consumer_secret)
|
19
19
|
end
|
20
20
|
|
21
21
|
it 'passes the quanto URL' do
|
22
|
-
|
22
|
+
OAuth2::Client.should_receive(:new) do |key, secret, options|
|
23
23
|
expect(options[:site]).to eq('http://quanto.herokuapp.com')
|
24
24
|
end
|
25
25
|
Quanto::Client.new(consumer_key, consumer_secret)
|
@@ -29,7 +29,7 @@ describe Quanto::Client do
|
|
29
29
|
|
30
30
|
describe '#access_token' do
|
31
31
|
|
32
|
-
let(:
|
32
|
+
let(:client) { double('OAuth2::Client') }
|
33
33
|
let(:client) { Quanto::Client.new(consumer_key, consumer_secret, options) }
|
34
34
|
|
35
35
|
context 'without credentials' do
|
@@ -44,16 +44,18 @@ describe Quanto::Client do
|
|
44
44
|
|
45
45
|
context 'with credentials' do
|
46
46
|
|
47
|
-
let(:options) { { access_token: 'token'
|
47
|
+
let(:options) { { access_token: 'token' } }
|
48
48
|
|
49
49
|
it 'creates an access token' do
|
50
|
-
|
50
|
+
OAuth2::AccessToken.should_receive(:new)
|
51
51
|
client.send(:access_token)
|
52
52
|
end
|
53
53
|
|
54
54
|
it 'passes the consumer' do
|
55
|
-
|
56
|
-
|
55
|
+
OAuth2::AccessToken
|
56
|
+
.should_receive(:new)
|
57
|
+
.with(anything, options[:access_token])
|
58
|
+
client.stub(:client).and_return(double('OAuth2::Client'))
|
57
59
|
client.send(:access_token)
|
58
60
|
end
|
59
61
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rasmus Rygaard
|
@@ -86,7 +86,7 @@ files:
|
|
86
86
|
- quanto-ruby.gemspec
|
87
87
|
- spec/quanto_client_spec.rb
|
88
88
|
- spec/spec_helper.rb
|
89
|
-
homepage:
|
89
|
+
homepage: https://github.com/rasmusrygaard/quanto-ruby
|
90
90
|
licenses:
|
91
91
|
- MIT
|
92
92
|
metadata: {}
|