omniauth-quickbooks-oauth2 0.1.0.alpha

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a102d5bb79949e3b8a6904ffdfa4546696e0609c
4
+ data.tar.gz: 4a129d7ce33b4bcbc810b4b3839b8fb70b594c28
5
+ SHA512:
6
+ metadata.gz: 8c9301e2b126abde32b20bca556ca687881a6f3e40126f264d579f2a926c1f1799c60c0d616f54f4e9a6b7a3fe05625629d961840bfaf75be9f137eb033451e8
7
+ data.tar.gz: d214f87a0d96f29e49be0800162f38d8972622bd4a387ef93d1756662da4544188f73e9074bd44f031147e8b7697a80e017dbd3a9eeaff82c3b9affa79c53f1f
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ *~
2
+ /vendor
3
+ # OS X
4
+ .DS_STORE
5
+ .bundle/
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Abe Land
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all 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,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,49 @@
1
+ # omniauth-quickbooks-oauth2
2
+
3
+ This gem provides an Omniauth strategy to connect with Quickbooks (via Intuit) using OAuth2.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'omniauth-quickbooks-oauth2'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install omniauth-quickbooks-oauth2
20
+
21
+ ## Usage
22
+
23
+ In your omniauth initializer file (e.g. `config/initializers/omniauth.rb`), you will want to add the following:
24
+
25
+ ```ruby
26
+ Rails.application.config.middleware.use OmniAuth::Builder do
27
+ ...
28
+ provider(
29
+ :quickbooks_oauth2,
30
+ ENV['INTUIT_CLIENT_ID'],
31
+ ENV['INTUIT_CLIENT_SECRET'],
32
+ scope: 'com.intuit.quickbooks.accounting openid profile email phone address',
33
+ sandbox: Rails.env.development?,
34
+ )
35
+ ...
36
+ end
37
+ ```
38
+
39
+ **NOTE: The above environment variable names and scope are just what I use in my particular project. The environment variables can be named whatever and you should consult [Intuit's documentation](https://developer.intuit.com/docs/00_quickbooks_online/2_build/10_authentication_and_authorization/10_oauth_2.0#/Initiating_the_authorization_request) to figure out which scopes your application should ask for.**
40
+
41
+ **ALSO NOTE: If the `sandbox` parameter is not explicitly set to `false`, then the strategy will default to using the sandbox endpoints for Intuit's API.**
42
+
43
+ ## Contributing
44
+
45
+ Bug reports and pull requests are welcome on GitHub at https://github.com/abeland/omniauth-quickbooks-oauth2.
46
+
47
+ ## License
48
+
49
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
@@ -0,0 +1,2 @@
1
+ require 'omniauth-quickbooks-oauth2/version'
2
+ require 'omniauth/strategies/quickbooks_oauth2'
@@ -0,0 +1,5 @@
1
+ module OmniAuth
2
+ module QuickbooksOauth2
3
+ VERSION = '0.1.0.alpha'.freeze
4
+ end
5
+ end
@@ -0,0 +1,42 @@
1
+ require 'omniauth-oauth2'
2
+
3
+ module OmniAuth
4
+ module Strategies
5
+ class QuickbooksOauth2 < OmniAuth::Strategies::OAuth2
6
+ option :name, :quickbooks_oauth2
7
+
8
+ option(
9
+ :client_options,
10
+ {
11
+ site: 'https://appcenter.intuit.com/connect/oauth2',
12
+ authorize_url: 'https://appcenter.intuit.com/connect/oauth2',
13
+ token_url: 'https://oauth.platform.intuit.com/oauth2/v1/tokens/bearer',
14
+ },
15
+ )
16
+
17
+ uid { request.params['realmId'] }
18
+
19
+ info do
20
+ raw_info
21
+ end
22
+
23
+ extra do
24
+ { raw_info: raw_info }
25
+ end
26
+
27
+ def raw_info
28
+ @raw_info ||= JSON.parse(access_token.get("https://#{accounts_domain}/v1/openid_connect/userinfo").body)
29
+ end
30
+
31
+ def callback_url
32
+ options[:redirect_uri] || (full_host + script_name + callback_path)
33
+ end
34
+
35
+ private
36
+
37
+ def accounts_domain
38
+ false == options.sandbox ? 'accounts.platform.intuit.com' : 'sandbox-accounts.platform.intuit.com'
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,27 @@
1
+ lib = File.expand_path("../lib", __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require "omniauth-quickbooks-oauth2/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "omniauth-quickbooks-oauth2"
7
+ spec.version = OmniAuth::QuickbooksOauth2::VERSION
8
+ spec.authors = ["Abe Land"]
9
+ spec.email = ["codeclimbcoffee@gmail.com"]
10
+
11
+ spec.summary = 'OAuth2 Omniauth strategy for Quickbooks.'
12
+ spec.description = 'OAuth2 Omniauth straetgy for Quickbooks (Intuit) API.'
13
+ spec.homepage = 'https://github.com/abeland/omniauth-quickbooks-oauth2'
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split("\n")
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_dependency 'omniauth', '~>1.3'
22
+ spec.add_dependency 'omniauth-oauth2', '~>1.5'
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.16"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ spec.add_development_dependency "rspec", "~> 3"
27
+ end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe OmniAuth::Strategies::QuickbooksOauth2 do
4
+ context 'sandbox' do
5
+ it 'should default to sandbox' do
6
+ strat = OmniAuth::Strategies::QuickbooksOauth2.new('foo', 'bar')
7
+ expect(strat.send(:accounts_domain)).to eq('sandbox-accounts.platform.intuit.com')
8
+ end
9
+
10
+ it 'should respect the sandbox option' do
11
+ strat = OmniAuth::Strategies::QuickbooksOauth2.new('foo', 'bar', sandbox: true)
12
+ expect(strat.send(:accounts_domain)).to eq('sandbox-accounts.platform.intuit.com')
13
+
14
+ strat = OmniAuth::Strategies::QuickbooksOauth2.new('foo', 'bar', sandbox: false)
15
+ expect(strat.send(:accounts_domain)).to eq('accounts.platform.intuit.com')
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,2 @@
1
+ require 'rspec'
2
+ require 'omniauth-quickbooks-oauth2'
metadata ADDED
@@ -0,0 +1,125 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-quickbooks-oauth2
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0.alpha
5
+ platform: ruby
6
+ authors:
7
+ - Abe Land
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-01-12 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.3'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
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.5'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.5'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.16'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.16'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3'
83
+ description: OAuth2 Omniauth straetgy for Quickbooks (Intuit) API.
84
+ email:
85
+ - codeclimbcoffee@gmail.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".gitignore"
91
+ - Gemfile
92
+ - LICENSE.txt
93
+ - README.md
94
+ - Rakefile
95
+ - lib/omniauth-quickbooks-oauth2.rb
96
+ - lib/omniauth-quickbooks-oauth2/version.rb
97
+ - lib/omniauth/strategies/quickbooks_oauth2.rb
98
+ - omniauth-quickbooks-oauth2.gemspec
99
+ - spec/omniauth/strategies/quickbooks_oauth2_spec.rb
100
+ - spec/spec_helper.rb
101
+ homepage: https://github.com/abeland/omniauth-quickbooks-oauth2
102
+ licenses:
103
+ - MIT
104
+ metadata: {}
105
+ post_install_message:
106
+ rdoc_options: []
107
+ require_paths:
108
+ - lib
109
+ required_ruby_version: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - ">="
112
+ - !ruby/object:Gem::Version
113
+ version: '0'
114
+ required_rubygems_version: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">"
117
+ - !ruby/object:Gem::Version
118
+ version: 1.3.1
119
+ requirements: []
120
+ rubyforge_project:
121
+ rubygems_version: 2.6.11
122
+ signing_key:
123
+ specification_version: 4
124
+ summary: OAuth2 Omniauth strategy for Quickbooks.
125
+ test_files: []