omniauth-1dtouch-music 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f1dddafb1bf55db0a4c2fed058a4e10e8793811d
4
+ data.tar.gz: fa89177a974b2ba3435008b65a3d40f518850a99
5
+ SHA512:
6
+ metadata.gz: c998bfd714f13b0a79e3bb41c1b9c6fc8921012593b22dcb11bb8266057fa71aa94f40499d967217ab4ff1055618426533e4334368586e12041b23e4afb65e7b
7
+ data.tar.gz: 25fb26fd8f8b64ea41f0d5f286ba57897a625d525b2484e3298811146ee4f4f50da4be9ffbd86bb4e34f7b21c43ab191e2130fff5841c7710e0eaee26725494e
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.2
4
+
5
+ cache: bundler
6
+
7
+ sudo: false
8
+
9
+ script: "bundle exec rspec"
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
@@ -0,0 +1,75 @@
1
+ # Omniauth::OnedtouchMusic
2
+
3
+ This gem contains the OmniAuth strategy to authenticate against http://music.1touch.com.
4
+
5
+ Music app provides an Oauth2 authentication process.
6
+
7
+ ## Before You Begin
8
+
9
+ You should have already installed OmniAuth into your app; if not, read the [OmniAuth README](https://github.com/intridea/omniauth) to get started.
10
+
11
+ You should have an API Key and API Secret for Music app. This is what your web application will use to authenticate against the API. Please contact http://music.1touch.com admin team to request a new application authorization.
12
+
13
+ ## Using This Strategy
14
+
15
+ First start by adding this gem to your Gemfile:
16
+
17
+ ```ruby
18
+ gem 'omniauth-1dtouch-music'
19
+ ```
20
+
21
+ If you need to use the latest HEAD version, you can do so with:
22
+
23
+ ```ruby
24
+ gem 'omniauth-1dtouch-music', :github => 'craftsmen/omniauth-1dtouch-music'
25
+ ```
26
+
27
+ Next, tell OmniAuth about this provider. For a Rails app, your `config/initializers/omniauth.rb` file should look like this:
28
+
29
+ ```ruby
30
+ Rails.application.config.middleware.use OmniAuth::Builder do
31
+ provider :onedtouch_music, "API_KEY", "API_SECRET"
32
+ end
33
+ ```
34
+
35
+ Replace `"API_KEY"` and `"API_SECRET"` with the appropriate values.
36
+
37
+ ## Authentication Hash
38
+
39
+ An example auth hash available in `request.env['omniauth.auth']`:
40
+
41
+ ```ruby
42
+ {
43
+ provider: "onedtouch_music",
44
+ uid: "123456",
45
+ info: {
46
+ name: "Jim Morrison",
47
+ email: "theblue@b.us"
48
+ },
49
+ credentials: {
50
+ token: "a1b2c3d4...", # The OAuth 2.0 access token
51
+ secret: "abcdef1234"
52
+ },
53
+ extra: {
54
+ access_token: "", # An OAuth::AccessToken object
55
+ raw_info: {
56
+ name: "Jim Morrison",
57
+ email: "theblue@b.us"
58
+ }
59
+ }
60
+ }
61
+ ```
62
+
63
+ ## Supported Rubies
64
+
65
+ Tested under 2.2.1.
66
+
67
+ ## License
68
+
69
+ Copyright (c) 2015 by 1D touch
70
+
71
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
72
+
73
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
74
+
75
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "omniauth/music"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,2 @@
1
+ require 'omniauth/1dtouch-music/version'
2
+ require 'omniauth/strategies/1dtouch-music'
@@ -0,0 +1,5 @@
1
+ module OmniAuth
2
+ module OnedtouchMusic
3
+ VERSION = '1.0.0'
4
+ end
5
+ end
@@ -0,0 +1,25 @@
1
+ require 'omniauth-oauth2'
2
+
3
+ module OmniAuth
4
+ module Strategies
5
+ class OnedtouchMusic < OmniAuth::Strategies::OAuth2
6
+ option :name, 'onedtouch_music'
7
+
8
+ option :client_options, site: 'http://music.1dtouch.com',
9
+ authorize_url: '/oauth/authorize'
10
+
11
+ uid { raw_info['id'] }
12
+
13
+ info do
14
+ {
15
+ email: raw_info['email'],
16
+ name: raw_info['name']
17
+ }
18
+ end
19
+
20
+ def raw_info
21
+ @raw_info ||= access_token.get('/api/v1/me.json').parsed
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'omniauth/1dtouch-music/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'omniauth-1dtouch-music'
8
+ spec.version = OmniAuth::OnedtouchMusic::VERSION
9
+ spec.authors = ['Sébastien Charrier']
10
+ spec.email = ['sebastien@craftsmen.io']
11
+ spec.summary = 'Omniauth strategy for 1D touch Music app'
12
+ spec.description = 'Omniauth strategy for 1D touch Music app'
13
+ spec.homepage = 'http://github.com/craftsmen/omniauth-1dtouch-music'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.bindir = 'exe'
18
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_runtime_dependency 'omniauth-oauth2', '~> 1.2'
22
+
23
+ spec.add_development_dependency 'bundler'
24
+ spec.add_development_dependency 'rake', '~> 10.0'
25
+ spec.add_development_dependency 'rspec'
26
+ spec.add_development_dependency 'shoulda-matchers'
27
+ spec.add_development_dependency 'simplecov'
28
+ spec.add_development_dependency 'webmock'
29
+ end
metadata ADDED
@@ -0,0 +1,154 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-1dtouch-music
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Sébastien Charrier
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-03-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: omniauth-oauth2
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: shoulda-matchers
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: simplecov
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: webmock
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: Omniauth strategy for 1D touch Music app
112
+ email:
113
+ - sebastien@craftsmen.io
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - ".gitignore"
119
+ - ".rspec"
120
+ - ".travis.yml"
121
+ - Gemfile
122
+ - README.md
123
+ - Rakefile
124
+ - bin/console
125
+ - bin/setup
126
+ - lib/omniauth-1dtouch-music.rb
127
+ - lib/omniauth/1dtouch-music/version.rb
128
+ - lib/omniauth/strategies/1dtouch-music.rb
129
+ - omniauth-1dtouch-music.gemspec
130
+ homepage: http://github.com/craftsmen/omniauth-1dtouch-music
131
+ licenses:
132
+ - MIT
133
+ metadata: {}
134
+ post_install_message:
135
+ rdoc_options: []
136
+ require_paths:
137
+ - lib
138
+ required_ruby_version: !ruby/object:Gem::Requirement
139
+ requirements:
140
+ - - ">="
141
+ - !ruby/object:Gem::Version
142
+ version: '0'
143
+ required_rubygems_version: !ruby/object:Gem::Requirement
144
+ requirements:
145
+ - - ">="
146
+ - !ruby/object:Gem::Version
147
+ version: '0'
148
+ requirements: []
149
+ rubyforge_project:
150
+ rubygems_version: 2.2.2
151
+ signing_key:
152
+ specification_version: 4
153
+ summary: Omniauth strategy for 1D touch Music app
154
+ test_files: []