omniauth-gumroad 1.0.0

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 021572b91013ee500effe481e1234c237b5b3a37
4
+ data.tar.gz: 7ff3d40849c447ffecec0bfd9e501496ecd3306b
5
+ SHA512:
6
+ metadata.gz: 0c41ba16d77ecf9f5720c11be72124c85890480246d8d3ec88076d18b22aa97c6719ac3fb65f91e5fec74c70a188eaff5a8dd629dfcb8011b93a5d3b73bf21db
7
+ data.tar.gz: 4a76107a04b0e7ebb6017ad96f564d74f812cbda479f3d062056a794928bd5a7fa3c3f11eb3fa459f126181044bca06bf8b126c49d77e56f0a825c21449c7a08
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ coverage
6
+ InstalledFiles
7
+ lib/bundler/man
8
+ pkg
9
+ rdoc
10
+ spec/reports
11
+ test/tmp
12
+ test/version_tmp
13
+ tmp
14
+
15
+ # YARD artifacts
16
+ .yardoc
17
+ _yardoc
18
+ doc/
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - jruby-19mode # JRuby in 1.9 mode
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem 'rake'
4
+ gemspec
@@ -0,0 +1,69 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ omniauth-gumroad (1.0.0)
5
+ omniauth (~> 1.0)
6
+ omniauth-oauth2 (~> 1.1)
7
+
8
+ GEM
9
+ remote: http://rubygems.org/
10
+ specs:
11
+ addressable (2.3.5)
12
+ crack (0.4.1)
13
+ safe_yaml (~> 0.9.0)
14
+ diff-lcs (1.2.5)
15
+ docile (1.1.2)
16
+ faraday (0.9.0)
17
+ multipart-post (>= 1.2, < 3)
18
+ hashie (2.0.5)
19
+ jwt (0.1.11)
20
+ multi_json (>= 1.5)
21
+ multi_json (1.8.4)
22
+ multi_xml (0.5.5)
23
+ multipart-post (2.0.0)
24
+ oauth2 (0.9.3)
25
+ faraday (>= 0.8, < 0.10)
26
+ jwt (~> 0.1.8)
27
+ multi_json (~> 1.3)
28
+ multi_xml (~> 0.5)
29
+ rack (~> 1.2)
30
+ omniauth (1.2.1)
31
+ hashie (>= 1.2, < 3)
32
+ rack (~> 1.0)
33
+ omniauth-oauth2 (1.1.2)
34
+ faraday (>= 0.8, < 0.10)
35
+ multi_json (~> 1.3)
36
+ oauth2 (~> 0.9.3)
37
+ omniauth (~> 1.2)
38
+ rack (1.5.2)
39
+ rack-test (0.6.2)
40
+ rack (>= 1.0)
41
+ rake (10.1.1)
42
+ rspec (2.14.1)
43
+ rspec-core (~> 2.14.0)
44
+ rspec-expectations (~> 2.14.0)
45
+ rspec-mocks (~> 2.14.0)
46
+ rspec-core (2.14.7)
47
+ rspec-expectations (2.14.4)
48
+ diff-lcs (>= 1.1.3, < 2.0)
49
+ rspec-mocks (2.14.4)
50
+ safe_yaml (0.9.7)
51
+ simplecov (0.8.2)
52
+ docile (~> 1.1.0)
53
+ multi_json
54
+ simplecov-html (~> 0.8.0)
55
+ simplecov-html (0.8.0)
56
+ webmock (1.17.1)
57
+ addressable (>= 2.2.7)
58
+ crack (>= 0.3.2)
59
+
60
+ PLATFORMS
61
+ ruby
62
+
63
+ DEPENDENCIES
64
+ omniauth-gumroad!
65
+ rack-test
66
+ rake
67
+ rspec (~> 2.7)
68
+ simplecov
69
+ webmock
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Maxwell Elliott
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,48 @@
1
+ # OmniAuth Gumroad
2
+
3
+ [![Build Status](https://travis-ci.org/maxwellE/omniauth-gumroad.png?branch=master)](https://travis-ci.org/maxwellE/omniauth-gumroad)
4
+
5
+ This is the offical OmniAuth strategy for authenticating to Gumroad. To use it, you'll need to sign up for an OAuth Application ID and Application Secret on the [Gumroad Applications Page](https://gumroad.com/settings/developer).
6
+
7
+ ## Basic Usage
8
+
9
+ ```ruby
10
+ use OmniAuth::Builder do
11
+ provider :gumroad, ENV['GUMROAD_APPLICATION_ID'], ENV['GUMROAD_APP_SECRET']
12
+ end
13
+ ```
14
+
15
+ ## Scopes
16
+
17
+ The Gumroad API lets you set scopes to provide varying levels of access to different types of data.
18
+
19
+ ```ruby
20
+ use OmniAuth::Builder do
21
+ provider :gumroad, ENV['GUMROAD_APPLICATION_ID'], ENV['GUMROAD_APP_SECRET'], scope: 'edit_products'
22
+ end
23
+ ```
24
+
25
+ Learn more about [Scopes](https://gumroad.com/api#api-scopes).
26
+
27
+ ## License
28
+
29
+ The MIT License (MIT)
30
+
31
+ Copyright (c) 2014 Maxwell Elliott
32
+
33
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
34
+ this software and associated documentation files (the "Software"), to deal in
35
+ the Software without restriction, including without limitation the rights to
36
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
37
+ the Software, and to permit persons to whom the Software is furnished to do so,
38
+ subject to the following conditions:
39
+
40
+ The above copyright notice and this permission notice shall be included in all
41
+ copies or substantial portions of the Software.
42
+
43
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
44
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
45
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
46
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
47
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
48
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
3
+ require 'rspec/core/rake_task'
4
+
5
+ RSpec::Core::RakeTask.new
6
+
7
+ desc 'Run specs'
8
+ task :default => :spec
@@ -0,0 +1,2 @@
1
+ require "omniauth-gumroad/version"
2
+ require "omniauth/strategies/gumroad"
@@ -0,0 +1,6 @@
1
+ module OmniAuth
2
+ module Gumroad
3
+ VERSION = "1.0.0"
4
+ end
5
+ end
6
+
@@ -0,0 +1,56 @@
1
+ require "omniauth/strategies/oauth2"
2
+
3
+ module OmniAuth
4
+ module Strategies
5
+ class Gumroad < OmniAuth::Strategies::OAuth2
6
+
7
+ option :name, "gumroad"
8
+
9
+ option :client_options, {
10
+ authorize_url: "https://gumroad.com/oauth/authorize",
11
+ token_url: "https://gumroad.com/oauth/token",
12
+ site: "https://gumroad.com"
13
+ }
14
+
15
+ def request_phase
16
+ super
17
+ end
18
+
19
+ def authorize_params
20
+ super.tap do |params|
21
+ %w[scope client_options].each do |v|
22
+ if request.params[v]
23
+ params[v.to_sym] = request.params[v]
24
+ end
25
+ end
26
+ end
27
+ end
28
+
29
+ def callback_url
30
+ options[:redirect_uri] || super
31
+ end
32
+
33
+ info do
34
+ {
35
+ name: raw_info["user"]["name"],
36
+ bio: raw_info["user"]["bio"],
37
+ facebook_profile: raw_info["user"]["facebook_profile"],
38
+ twitter_handle: raw_info["user"]["twitter_handle"],
39
+ id: raw_info["user"]["id"]
40
+ }
41
+ end
42
+
43
+ uid { raw_info["id"].to_s }
44
+
45
+ extra do
46
+ { raw_info: raw_info }
47
+ end
48
+
49
+ def raw_info
50
+ @raw_info ||= access_token.get("/api/v2/user").parsed
51
+ end
52
+ end
53
+ end
54
+ end
55
+
56
+ OmniAuth.config.add_camelization "gumroad", "Gumroad"
@@ -0,0 +1,25 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/omniauth-gumroad/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.name = "omniauth-gumroad"
6
+ gem.version = OmniAuth::Gumroad::VERSION
7
+ gem.authors = ["Maxwell Elliott"]
8
+ gem.email = ["maxwell@gumroad.com"]
9
+ gem.homepage = "https://github.com/gumroad/omniauth-gumroad"
10
+ gem.summary = %q{OmniAuth strategy for Gumroad}
11
+ gem.description = %q{OmniAuth strategy for Gumroad, see https://github.com/gumroad/omniauth-gumroad for examples and more information.}
12
+ gem.license = 'MIT'
13
+
14
+ gem.files = `git ls-files`.split("\n")
15
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
+ gem.require_paths = ["lib"]
18
+
19
+ gem.add_dependency 'omniauth', '~> 1.0'
20
+ gem.add_dependency 'omniauth-oauth2', '~> 1.1'
21
+ gem.add_development_dependency 'rspec', '~> 2.7'
22
+ gem.add_development_dependency 'rack-test'
23
+ gem.add_development_dependency 'simplecov'
24
+ gem.add_development_dependency 'webmock'
25
+ end
@@ -0,0 +1,26 @@
1
+ require 'spec_helper'
2
+
3
+ describe OmniAuth::Strategies::Gumroad do
4
+ let(:client) do
5
+ OmniAuth::Strategies::Gumroad.new('GUMROAD_APP_KEY', 'GUMROAD_SECRET_KEY')
6
+ end
7
+
8
+ context "client options" do
9
+ it "should have the correct site" do
10
+ client.options.client_options.site.should eq "https://gumroad.com"
11
+ end
12
+
13
+ it "should have the correct authorize url" do
14
+ client.options.client_options.authorize_url.should eq "https://gumroad.com/oauth/authorize"
15
+ end
16
+
17
+ it "should have the correct token url" do
18
+ client.options.client_options.token_url.should eq "https://gumroad.com/oauth/token"
19
+ end
20
+
21
+ it "should allow users to override the default redirect_uri if provided" do
22
+ custom_client = OmniAuth::Strategies::Gumroad.new('GUMROAD_APP_KEY', 'GUMROAD_SECRET_KEY', client_options: { redirect_uri: "http://test.com/callback" })
23
+ custom_client.options.client_options.redirect_uri.should eq "http://test.com/callback"
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,12 @@
1
+ $:.unshift File.expand_path('..', __FILE__)
2
+ require 'rspec'
3
+ require 'rack/test'
4
+ require 'webmock/rspec'
5
+ require 'omniauth'
6
+ require 'omniauth-gumroad'
7
+
8
+ RSpec.configure do |config|
9
+ config.include WebMock::API
10
+ config.include Rack::Test::Methods
11
+ config.extend OmniAuth::Test::StrategyMacros, :type => :strategy
12
+ end
metadata ADDED
@@ -0,0 +1,145 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-gumroad
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Maxwell Elliott
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-01-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: omniauth
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: omniauth-oauth2
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '1.1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '2.7'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '2.7'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rack-test
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: simplecov
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: webmock
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
+ description: OmniAuth strategy for Gumroad, see https://github.com/gumroad/omniauth-gumroad
98
+ for examples and more information.
99
+ email:
100
+ - maxwell@gumroad.com
101
+ executables: []
102
+ extensions: []
103
+ extra_rdoc_files: []
104
+ files:
105
+ - .gitignore
106
+ - .travis.yml
107
+ - Gemfile
108
+ - Gemfile.lock
109
+ - LICENSE
110
+ - README.md
111
+ - Rakefile
112
+ - lib/omniauth-gumroad.rb
113
+ - lib/omniauth-gumroad/version.rb
114
+ - lib/omniauth/strategies/gumroad.rb
115
+ - omniauth-gumroad.gemspec
116
+ - spec/omniauth/strategies/gumroad_spec.rb
117
+ - spec/spec_helper.rb
118
+ homepage: https://github.com/gumroad/omniauth-gumroad
119
+ licenses:
120
+ - MIT
121
+ metadata: {}
122
+ post_install_message:
123
+ rdoc_options: []
124
+ require_paths:
125
+ - lib
126
+ required_ruby_version: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - '>='
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
131
+ required_rubygems_version: !ruby/object:Gem::Requirement
132
+ requirements:
133
+ - - '>='
134
+ - !ruby/object:Gem::Version
135
+ version: '0'
136
+ requirements: []
137
+ rubyforge_project:
138
+ rubygems_version: 2.0.6
139
+ signing_key:
140
+ specification_version: 4
141
+ summary: OmniAuth strategy for Gumroad
142
+ test_files:
143
+ - spec/omniauth/strategies/gumroad_spec.rb
144
+ - spec/spec_helper.rb
145
+ has_rdoc: