quanto-ruby 0.0.2 → 0.0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9d0bca22aa18dead18a8829b7357aef0226cf061
4
- data.tar.gz: 2dfd0c3d6cafaeabee2d0b31c03beb62b23a8329
3
+ metadata.gz: 50ca6459ee9dd8c1d65e57e93a8ef205b7865b73
4
+ data.tar.gz: 1940e1fcbb46cf452211f1d8c9f641b1ff4c3cc7
5
5
  SHA512:
6
- metadata.gz: 715da9a287f617b149384073541b3aed9b2a2ec1c93bf02eb27213fb5b877e2e73003bd4b73db898c1a3e186dee830a544ce687d3d73fb189dbd69a8091da5f5
7
- data.tar.gz: ddfa6121f2b53a25725fb5602854696e310fb53be67b28bff5801d80ab03abc2fe09b3dfc1b2fa1246f74436d4b9de0c63d357cb7d86580233f26bc318034e04
6
+ metadata.gz: afc149c898889d2bcc60259023a6279820a0062041562d3aab2c23acab7408d359c067ebf7fdf17ce9f8a5b341190ef2e6203dc11f512afc7d20081ad36efa07
7
+ data.tar.gz: a1bae7dd41f4ec07aa577d9831fea9f9d16db2042cc6949b93730229cd7f4c85a909d76775389848978c90001e6f614ecec6f6993e3ea5544819fc713ad60501
data/lib/quanto/client.rb CHANGED
@@ -30,7 +30,6 @@ module Quanto
30
30
  end
31
31
 
32
32
  def post(path, options)
33
- options[:date] ||= Date.today.to_s
34
33
  access_token.post(path, options)
35
34
  end
36
35
 
@@ -2,8 +2,13 @@ module Quanto
2
2
 
3
3
  class Client
4
4
 
5
- def record_metric(value, type)
6
- post('/metrics', { value: value, type: type })
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
@@ -1,3 +1,3 @@
1
1
  module Quanto
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
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($/)
@@ -8,18 +8,18 @@ describe Quanto::Client do
8
8
 
9
9
  describe '#initialize' do
10
10
 
11
- it 'constructs an OAuth consumer' do
12
- OAuth::Consumer.should_receive(:new)
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
- OAuth::Consumer.should_receive(:new).with(consumer_key, consumer_secret, anything)
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
- OAuth::Consumer.should_receive(:new) do |key, secret, options|
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(:consumer) { double('OAuth::Consumer') }
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', access_token_secret: 'secret' } }
47
+ let(:options) { { access_token: 'token' } }
48
48
 
49
49
  it 'creates an access token' do
50
- OAuth::AccessToken.should_receive(:new)
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
- OAuth::AccessToken.should_receive(:new).with(anything, options[:access_token], options[:access_token_secret])
56
- client.stub(:consumer).and_return(double('OAuth::Consumer'))
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.2
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: {}