omniauth-salesloft 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.
- checksums.yaml +7 -0
- data/.gitignore +18 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +25 -0
- data/Rakefile +1 -0
- data/lib/omniauth-salesloft.rb +2 -0
- data/lib/omniauth-salesloft/version.rb +5 -0
- data/lib/omniauth/strategies/salesloft.rb +33 -0
- data/omniauth-salesloft.gemspec +27 -0
- data/spec/omniauth/strategies/salesloft_spec.rb +55 -0
- data/spec/spec_helper.rb +2 -0
- metadata +134 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: adacb526b7105aa417a8def8a5941202ff08da7e
|
4
|
+
data.tar.gz: e5967de5d089f2ea357edb5e618d07137a743b53
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a185d97cdd9771e9bc78099fdf501b5e33baedf8ff08c056b4c2a3e3242427c84ff3eb39af285db8e77b9358faa7b4b06f1e47e4af5c282cacd7aab80b398d11
|
7
|
+
data.tar.gz: 109a6b3c539b08619c63cd9e77a4eb3a0607fddddea03b9c07a038ec82630ec2bb673c3c1564a7566fc27ae78f2bbb40812189db579d3f49f334c5e7c4a2b6ba
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 SalesLoft
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# Omniauth::Salesloft
|
2
|
+
|
3
|
+
An OmniAuth Strategy for Connecting to the SalesLoft Public API.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'omniauth-salesloft'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install omniauth-salesloft
|
18
|
+
|
19
|
+
## Contributing
|
20
|
+
|
21
|
+
1. Fork it ( http://github.com/SalesLoft/omniauth-salesloft/fork )
|
22
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
23
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
24
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
25
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require "omniauth-oauth2"
|
2
|
+
|
3
|
+
module OmniAuth
|
4
|
+
module Strategies
|
5
|
+
class SalesLoft < OmniAuth::Strategies::OAuth2
|
6
|
+
option :name, :salesloft
|
7
|
+
|
8
|
+
option :client_options, {
|
9
|
+
:site => "https://api.salesloft.com",
|
10
|
+
:authorize_url => "https://accounts.salesloft.com/oauth/authorize",
|
11
|
+
:token_url => "https://accounts.salesloft.com/oauth/token"
|
12
|
+
}
|
13
|
+
|
14
|
+
uid { raw_info["id"] }
|
15
|
+
|
16
|
+
info do
|
17
|
+
raw_info
|
18
|
+
end
|
19
|
+
|
20
|
+
def raw_info
|
21
|
+
@raw_info ||= access_token.get("/public_api/v1/me.json").parsed
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def callback_url
|
27
|
+
options[:redirect_uri] || (full_host + script_name + callback_path)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
OmniAuth.config.add_camelization "salesloft", "SalesLoft"
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'omniauth-salesloft/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "omniauth-salesloft"
|
8
|
+
spec.version = OmniAuth::Salesloft::VERSION
|
9
|
+
spec.authors = ["SalesLoft Engineering"]
|
10
|
+
spec.email = ["operations@salesloft.com"]
|
11
|
+
spec.summary = %q{OmniAuth strategy for SalesLoft}
|
12
|
+
spec.description = %q{OmniAuth strategy for SalesLoft}
|
13
|
+
spec.homepage = "https://github.com/salesloft/omniauth-salesloft"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_runtime_dependency 'omniauth', '>= 1.1.1'
|
22
|
+
spec.add_runtime_dependency 'omniauth-oauth2', '>= 1.3.1'
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.5"
|
25
|
+
spec.add_development_dependency 'rspec', '~> 3.2', '>= 3.2.0'
|
26
|
+
spec.add_development_dependency "rake"
|
27
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe OmniAuth::Strategies::SalesLoft do
|
4
|
+
let(:request) { double('Request', :params => {}, :cookies => {}, :env => {}) }
|
5
|
+
let(:app) {
|
6
|
+
lambda do
|
7
|
+
[200, {}, ["Hello."]]
|
8
|
+
end
|
9
|
+
}
|
10
|
+
|
11
|
+
subject do
|
12
|
+
OmniAuth::Strategies::SalesLoft.new(app, "appid", "secret", @options || {}).tap do |strategy|
|
13
|
+
allow(strategy).to receive(:request) { request }
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
before do
|
18
|
+
OmniAuth.config.test_mode = true
|
19
|
+
end
|
20
|
+
|
21
|
+
after do
|
22
|
+
OmniAuth.config.test_mode = false
|
23
|
+
end
|
24
|
+
|
25
|
+
describe "#client_options" do
|
26
|
+
it "has the correct site" do
|
27
|
+
expect(subject.client.site).to eq("https://api.salesloft.com")
|
28
|
+
end
|
29
|
+
|
30
|
+
it "has the correct authorize url" do
|
31
|
+
expect(subject.client.authorize_url).to eq("https://accounts.salesloft.com/oauth/authorize")
|
32
|
+
end
|
33
|
+
|
34
|
+
it "has the correct token url" do
|
35
|
+
expect(subject.client.token_url).to eq("https://accounts.salesloft.com/oauth/token")
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe "overrides" do
|
40
|
+
it "should allow overrides of the site" do
|
41
|
+
@options = {:client_options => {'site' => 'https://example.com'}}
|
42
|
+
expect(subject.client.site).to eq('https://example.com')
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should allow overrides of the authorize_url" do
|
46
|
+
@options = {:client_options => {'authorize_url' => 'https://example.com'}}
|
47
|
+
expect(subject.client.options[:authorize_url]).to eq('https://example.com')
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should allow overrides of the token url" do
|
51
|
+
@options = {:client_options => {'token_url' => 'https://example.com'}}
|
52
|
+
expect(subject.client.options[:token_url]).to eq('https://example.com')
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-salesloft
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- SalesLoft Engineering
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-06-09 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.1.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.1.1
|
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.3.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.3.1
|
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.5'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.5'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.2'
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: 3.2.0
|
65
|
+
type: :development
|
66
|
+
prerelease: false
|
67
|
+
version_requirements: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - "~>"
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '3.2'
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: 3.2.0
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: rake
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
type: :development
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
description: OmniAuth strategy for SalesLoft
|
90
|
+
email:
|
91
|
+
- operations@salesloft.com
|
92
|
+
executables: []
|
93
|
+
extensions: []
|
94
|
+
extra_rdoc_files: []
|
95
|
+
files:
|
96
|
+
- ".gitignore"
|
97
|
+
- ".rspec"
|
98
|
+
- Gemfile
|
99
|
+
- LICENSE.txt
|
100
|
+
- README.md
|
101
|
+
- Rakefile
|
102
|
+
- lib/omniauth-salesloft.rb
|
103
|
+
- lib/omniauth-salesloft/version.rb
|
104
|
+
- lib/omniauth/strategies/salesloft.rb
|
105
|
+
- omniauth-salesloft.gemspec
|
106
|
+
- spec/omniauth/strategies/salesloft_spec.rb
|
107
|
+
- spec/spec_helper.rb
|
108
|
+
homepage: https://github.com/salesloft/omniauth-salesloft
|
109
|
+
licenses:
|
110
|
+
- MIT
|
111
|
+
metadata: {}
|
112
|
+
post_install_message:
|
113
|
+
rdoc_options: []
|
114
|
+
require_paths:
|
115
|
+
- lib
|
116
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
117
|
+
requirements:
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
requirements: []
|
127
|
+
rubyforge_project:
|
128
|
+
rubygems_version: 2.4.5.1
|
129
|
+
signing_key:
|
130
|
+
specification_version: 4
|
131
|
+
summary: OmniAuth strategy for SalesLoft
|
132
|
+
test_files:
|
133
|
+
- spec/omniauth/strategies/salesloft_spec.rb
|
134
|
+
- spec/spec_helper.rb
|