fitbit-omni-api 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -52,7 +52,7 @@ Fitbit::Api.new({}).api_call(
52
52
  )
53
53
  ```
54
54
 
55
- OmniAuth Fitbit supports the Fitbit Resource Access API and the Fitbit Subscriptions API.
55
+ This gem supports the Fitbit Resource Access API and the Fitbit Subscriptions API.
56
56
 
57
57
  To access the Resource Access API, consult the API docs and provide the required parameters. For example,
58
58
  the API-Search-Foods method requires 'api-version', 'query' and 'response-format'. There's also an optional
@@ -1,3 +1,5 @@
1
+ require 'omniauth-fitbit'
2
+
1
3
  module Fitbit
2
4
  class Api < OmniAuth::Strategies::Fitbit
3
5
 
@@ -44,7 +46,7 @@ module Fitbit
44
46
 
45
47
  def missing_url_parameters? required, supplied
46
48
  url_parameters = get_url_parameters(required, supplied)
47
- required and supplied & url_parameters != url_parameters
49
+ url_parameters and url_parameters & supplied != url_parameters
48
50
  end
49
51
 
50
52
  def get_url_parameters required, supplied
@@ -56,9 +58,7 @@ module Fitbit
56
58
  end
57
59
 
58
60
  def get_dynamic_url_parameters required, supplied
59
- required.keys.each do |x|
60
- return required[x] if supplied.include? x
61
- end
61
+ required.keys.each { |k| return required[k] if supplied.include? k }
62
62
  end
63
63
 
64
64
  def missing_post_parameters? required, supplied
@@ -95,7 +95,7 @@ module Fitbit
95
95
  required.keys.each_with_index do |x,i|
96
96
  error << "(#{i+1}) #{required[x]} "
97
97
  end
98
- error
98
+ error << "You supplied: #{supplied}"
99
99
  end
100
100
 
101
101
  def post_parameters_error required, supplied
@@ -1,3 +1,2 @@
1
1
  require 'fitbit-omni-api/version'
2
- require 'omniauth/strategies/fitbit'
3
2
  require 'api/fitbit_api'
@@ -1,7 +1,7 @@
1
1
  module OmniAuth
2
2
  module Fitbit
3
3
  module Api
4
- VERSION = "0.0.1"
4
+ VERSION = "0.0.2"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fitbit-omni-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - TK Gospodinov
@@ -9,11 +10,12 @@ authors:
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2013-09-28 00:00:00.000000000 Z
13
+ date: 2013-11-12 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
- name: omniauth-oauth
16
+ name: omniauth-fitbit
16
17
  requirement: !ruby/object:Gem::Requirement
18
+ none: false
17
19
  requirements:
18
20
  - - ~>
19
21
  - !ruby/object:Gem::Version
@@ -21,28 +23,15 @@ dependencies:
21
23
  type: :runtime
22
24
  prerelease: false
23
25
  version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
24
27
  requirements:
25
28
  - - ~>
26
29
  - !ruby/object:Gem::Version
27
30
  version: '1.0'
28
- - !ruby/object:Gem::Dependency
29
- name: multi_xml
30
- requirement: !ruby/object:Gem::Requirement
31
- requirements:
32
- - - '>='
33
- - !ruby/object:Gem::Version
34
- version: '0'
35
- type: :runtime
36
- prerelease: false
37
- version_requirements: !ruby/object:Gem::Requirement
38
- requirements:
39
- - - '>='
40
- - !ruby/object:Gem::Version
41
- version: '0'
42
- description: OmniAuth strategy for Fitbit, plus api wrapper
31
+ description: Fitbit OmniAuth strategy + API wrapper
43
32
  email:
44
33
  - tk@gospodinov.net
45
- - Scott McGrat
34
+ - acid64k@yahoo.com
46
35
  executables: []
47
36
  extensions: []
48
37
  extra_rdoc_files: []
@@ -50,32 +39,32 @@ files:
50
39
  - lib/api/fitbit_api.rb
51
40
  - lib/fitbit-omni-api/version.rb
52
41
  - lib/fitbit-omni-api.rb
53
- - lib/omniauth/strategies/fitbit.rb
54
42
  - LICENSE.md
55
43
  - Rakefile
56
44
  - README.md
57
45
  homepage: http://github.com/scrawlon/fitbit-omni-api
58
46
  licenses:
59
47
  - MIT
60
- metadata: {}
61
48
  post_install_message:
62
49
  rdoc_options: []
63
50
  require_paths:
64
51
  - lib
65
52
  required_ruby_version: !ruby/object:Gem::Requirement
53
+ none: false
66
54
  requirements:
67
- - - '>='
55
+ - - ! '>='
68
56
  - !ruby/object:Gem::Version
69
57
  version: '0'
70
58
  required_rubygems_version: !ruby/object:Gem::Requirement
59
+ none: false
71
60
  requirements:
72
- - - '>='
61
+ - - ! '>='
73
62
  - !ruby/object:Gem::Version
74
63
  version: '0'
75
64
  requirements: []
76
65
  rubyforge_project:
77
- rubygems_version: 2.0.3
66
+ rubygems_version: 1.8.24
78
67
  signing_key:
79
- specification_version: 4
80
- summary: OmniAuth strategy for Fitbit, plus api wrapper
68
+ specification_version: 3
69
+ summary: Fitbit OmniAuth strategy + API wrapper
81
70
  test_files: []
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 3bb58a076555dbaeef38610a7e7cc2035542d1f5
4
- data.tar.gz: 1295e14ef5ce64bb429779109eac458c318f524d
5
- SHA512:
6
- metadata.gz: 0dbc41a2b02902432761fd992bda76de1cb5885cdf4d231bb851c235ee57d7be5a12ad21c4c33504fc79c7ba390f8ff8808643499b523549988550d945b07127
7
- data.tar.gz: 8fc3c5c81be51e371f440f75c3fd033412c9dcf2dce1da073704123313c75946d804bbde0fe2df524061c01fe7b83029db331782a819b2079479355b2c8bec6a
@@ -1,49 +0,0 @@
1
- require 'omniauth'
2
- require 'omniauth/strategies/oauth'
3
-
4
- module OmniAuth
5
- module Strategies
6
- class Fitbit < OmniAuth::Strategies::OAuth
7
-
8
- option :name, "fitbit"
9
-
10
- option :client_options, {
11
- :site => 'http://api.fitbit.com',
12
- :request_token_path => '/oauth/request_token',
13
- :access_token_path => '/oauth/access_token',
14
- :authorize_path => '/oauth/authorize'
15
- }
16
-
17
- uid do
18
- access_token.params['encoded_user_id']
19
- end
20
-
21
- info do
22
- {
23
- :full_name => raw_info['user']['fullName'],
24
- :display_name => raw_info['user']['displayName'],
25
- :nickname => raw_info['user']['nickname'],
26
- :gender => raw_info['user']['gender'],
27
- :about_me => raw_info['user']['aboutMe'],
28
- :city => raw_info['user']['city'],
29
- :state => raw_info['user']['state'],
30
- :country => raw_info['user']['country'],
31
- :dob => !raw_info['user']['dateOfBirth'].empty? ? Date.strptime(raw_info['user']['dateOfBirth'], '%Y-%m-%d'):nil,
32
- :member_since => Date.strptime(raw_info['user']['memberSince'], '%Y-%m-%d'),
33
- :locale => raw_info['user']['locale'],
34
- :timezone => raw_info['user']['timezone']
35
- }
36
- end
37
-
38
- extra do
39
- {
40
- :raw_info => raw_info
41
- }
42
- end
43
-
44
- def raw_info
45
- @raw_info ||= MultiJson.load(access_token.get('http://api.fitbit.com/1/user/-/profile.json').body)
46
- end
47
- end
48
- end
49
- end