fatsecret-omniauth 0.0.1 → 0.0.2

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.
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # FatSecret OmniAuth Gem
1
+ # FatSecret OmniAuth Gem v0.0.2
2
2
 
3
3
  First things first - This is NOT an [OmniAuth] Strategy. This is not meant to be used as a Login
4
4
  method for web apps. This gem leverages OmniAuth's OAuth Strategy to obtain __auth tokens__ and
@@ -16,8 +16,10 @@ gem 'fatsecret-omniauth'
16
16
  Then run `bundle install`
17
17
 
18
18
  ___
19
- ## Usage
20
- Add the following to your middleware in `config/initializers/omniauth.rb`:
19
+ ## Authentication
20
+ This works like any other OmniAuth strategy.
21
+ Add the following to `config/initializers/omniauth.rb`:
22
+
21
23
  ```ruby
22
24
  Rails.application.config.middleware.use OmniAuth::Builder do
23
25
  provider :fatsecret, 'consumer_key', 'consumer_secret'
@@ -32,14 +34,17 @@ __NOTE:__ *OmniAuth strategies use `get '/auth/:provider/callback', to: 'session
32
34
  The FatSecret OmniAuth gem requires a custom controller/create method to save the
33
35
  auth tokens in a database for future API calls.*
34
36
 
35
- When your app calls FatSecret and the user authorizes, the `request.env['omniauth.auth']`
36
- hash will contain your user data.
37
-
38
- * __FatSecret profile data__ is contained in:
39
- `request.env['omniauth.auth']['info']` -- see the [FatSecret profile.get page] for more details.
40
-
41
- * __FatSecret auth token and auth secret__ are contained in:
42
- `request.env['omniauth.auth']['credentials']`
37
+ To authenticate wuth FatSsecret
38
+ * load `/auth/fatsecret`
39
+ * You'll be redirected to FatSecret.com to authenticate
40
+ * If you agree to authenticate, you'll be redirected back `/auth/fatsecret/callback`
41
+ * The `request.env['omniauth.auth']` hash will contain your FatSecret data.
42
+
43
+ * __FatSecret profile data__ is contained in:
44
+ `request.env['omniauth.auth']['info']` -- see the [FatSecret profile.get page] for more details.
45
+
46
+ * __FatSecret auth token and auth secret__ are contained in:
47
+ `request.env['omniauth.auth']['credentials']`
43
48
 
44
49
  [FatSecret profile.get page]: http://platform.fatsecret.com/api/Default.aspx?screen=rapiref&method=profile.get "FatSecret profile.get page"
45
50
 
data/Rakefile CHANGED
@@ -36,3 +36,11 @@ end
36
36
 
37
37
 
38
38
  task :default => :test
39
+
40
+ require "bundler/gem_tasks"
41
+ require "rspec/core/rake_task"
42
+
43
+ RSpec::Core::RakeTask.new
44
+
45
+ task :default => :spec
46
+ task :test => :spec
@@ -0,0 +1,23 @@
1
+ module Fatsecret
2
+ class Api < OmniAuth::Strategies::Fatsecret
3
+ option :client_options, {
4
+ :scheme => :query_string,
5
+ :http_method => :get
6
+ }
7
+
8
+ def api_call consumer_key, consumer_secret, params, auth_token=nil, auth_secret=nil
9
+ request = build_request(consumer_key, consumer_secret, auth_token, auth_secret)
10
+ request_params = uri(params)
11
+ request.get "http://platform.fatsecret.com/rest/server.api?#{ request_params }"
12
+ end
13
+
14
+ def uri params
15
+ normalize = OAuth::Helper.normalize(params)
16
+ end
17
+
18
+ def build_request consumer_key, consumer_secret, auth_token, auth_secret
19
+ fatsecret = Fatsecret::Api.new :fatsecret, consumer_key, consumer_secret
20
+ access_token = OAuth::AccessToken.new fatsecret.consumer, auth_token, auth_secret
21
+ end
22
+ end
23
+ end
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module Fatsecret
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
@@ -1,2 +1,3 @@
1
1
  require 'fatsecret-omniauth/version'
2
2
  require 'omniauth/strategies/fatsecret'
3
+ require 'api/fatsecret_api'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fatsecret-omniauth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-12 00:00:00.000000000 Z
12
+ date: 2013-08-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: omniauth-oauth
@@ -59,6 +59,22 @@ dependencies:
59
59
  - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: rake
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
62
78
  - !ruby/object:Gem::Dependency
63
79
  name: rack-test
64
80
  requirement: !ruby/object:Gem::Requirement
@@ -82,6 +98,7 @@ executables: []
82
98
  extensions: []
83
99
  extra_rdoc_files: []
84
100
  files:
101
+ - lib/api/fatsecret_api.rb
85
102
  - lib/fatsecret-omniauth/version.rb
86
103
  - lib/fatsecret-omniauth.rb
87
104
  - lib/omniauth/strategies/fatsecret.rb
@@ -90,7 +107,8 @@ files:
90
107
  - Rakefile
91
108
  - README.md
92
109
  homepage: https://github.com/scrawlon/fatsecret-omniauth
93
- licenses: []
110
+ licenses:
111
+ - MIT
94
112
  post_install_message:
95
113
  rdoc_options: []
96
114
  require_paths: