omniauth-nimble 0.0.1
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/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +5 -0
- data/README.md +27 -0
- data/Rakefile +1 -0
- data/lib/omniauth-nimble.rb +2 -0
- data/lib/omniauth-nimble/version.rb +5 -0
- data/lib/omniauth/strategies/nimble.rb +45 -0
- data/omniauth-nimble.gemspec +22 -0
- metadata +86 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
data/README.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Omniauth::Nimble
|
|
2
|
+
|
|
3
|
+
TODO: Write a gem description
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Add this line to your application's Gemfile:
|
|
8
|
+
|
|
9
|
+
gem 'omniauth-nimble'
|
|
10
|
+
|
|
11
|
+
And then execute:
|
|
12
|
+
|
|
13
|
+
$ bundle
|
|
14
|
+
|
|
15
|
+
Or install it yourself as:
|
|
16
|
+
|
|
17
|
+
$ gem install omniauth-nimble
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
**Basic Usage**
|
|
22
|
+
|
|
23
|
+
use OmniAuth::Builder do
|
|
24
|
+
provider :nimble, ENV['NIMBLE_KEY'], ENV['NIMBLE_SECRET']
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
More detailed usage example can be found [here](https://github.com/nimblecrm/ruby-example/tree/master/Sample%201).
|
data/Rakefile
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require "bundler/gem_tasks"
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Copyright 2012 Nimble
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
4
|
+
# not use this file except in compliance with the License. You may obtain
|
|
5
|
+
# a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
require 'omniauth-oauth2'
|
|
8
|
+
|
|
9
|
+
module OmniAuth
|
|
10
|
+
module Strategies
|
|
11
|
+
class Nimble < OmniAuth::Strategies::OAuth2
|
|
12
|
+
option :name, "nimble"
|
|
13
|
+
|
|
14
|
+
option :client_options, {
|
|
15
|
+
:site => "https://api.nimble.com",
|
|
16
|
+
:authorize_url => '/oauth/authorize',
|
|
17
|
+
:token_url => '/oauth/token'
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
option :provider_ignores_state, true
|
|
21
|
+
|
|
22
|
+
uid { raw_info['email'] }
|
|
23
|
+
|
|
24
|
+
info do
|
|
25
|
+
{
|
|
26
|
+
'uid' => raw_info['email'],
|
|
27
|
+
'name' => raw_info['name'],
|
|
28
|
+
'email' => raw_info['email']
|
|
29
|
+
}
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
extra do
|
|
33
|
+
{ 'raw_info' => raw_info }
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def raw_info
|
|
37
|
+
access_token.options[:mode] = :query
|
|
38
|
+
access_token.options[:param_name] = :access_token
|
|
39
|
+
@raw_info ||= access_token.get('/api/users/myself/', {:parse => :json}).parsed
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
OmniAuth.config.add_camelization 'nimble', 'Nimble'
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'omniauth-nimble/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |gem|
|
|
7
|
+
gem.name = "omniauth-nimble"
|
|
8
|
+
gem.version = Omniauth::Nimble::VERSION
|
|
9
|
+
gem.authors = ["Pavel Dmitriev"]
|
|
10
|
+
gem.email = ["p.dmitriev@nimble.com"]
|
|
11
|
+
gem.description = %q{OAuth2 strategy to use with Nimble API}
|
|
12
|
+
gem.summary = %q{OAuth2 strategy to use with Nimble API}
|
|
13
|
+
gem.homepage = "https://github.com/nimblecrm/omniauth-nimble"
|
|
14
|
+
|
|
15
|
+
gem.add_dependency 'omniauth', '~> 1.0'
|
|
16
|
+
gem.add_dependency 'omniauth-oauth2', '~> 1.1'
|
|
17
|
+
|
|
18
|
+
gem.files = `git ls-files`.split($/)
|
|
19
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
|
20
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
|
21
|
+
gem.require_paths = ["lib"]
|
|
22
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: omniauth-nimble
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
prerelease:
|
|
6
|
+
platform: ruby
|
|
7
|
+
authors:
|
|
8
|
+
- Pavel Dmitriev
|
|
9
|
+
autorequire:
|
|
10
|
+
bindir: bin
|
|
11
|
+
cert_chain: []
|
|
12
|
+
date: 2012-10-22 00:00:00.000000000 Z
|
|
13
|
+
dependencies:
|
|
14
|
+
- !ruby/object:Gem::Dependency
|
|
15
|
+
name: omniauth
|
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
|
17
|
+
none: false
|
|
18
|
+
requirements:
|
|
19
|
+
- - ~>
|
|
20
|
+
- !ruby/object:Gem::Version
|
|
21
|
+
version: '1.0'
|
|
22
|
+
type: :runtime
|
|
23
|
+
prerelease: false
|
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
+
none: false
|
|
26
|
+
requirements:
|
|
27
|
+
- - ~>
|
|
28
|
+
- !ruby/object:Gem::Version
|
|
29
|
+
version: '1.0'
|
|
30
|
+
- !ruby/object:Gem::Dependency
|
|
31
|
+
name: omniauth-oauth2
|
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
|
33
|
+
none: false
|
|
34
|
+
requirements:
|
|
35
|
+
- - ~>
|
|
36
|
+
- !ruby/object:Gem::Version
|
|
37
|
+
version: '1.1'
|
|
38
|
+
type: :runtime
|
|
39
|
+
prerelease: false
|
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
41
|
+
none: false
|
|
42
|
+
requirements:
|
|
43
|
+
- - ~>
|
|
44
|
+
- !ruby/object:Gem::Version
|
|
45
|
+
version: '1.1'
|
|
46
|
+
description: OAuth2 strategy to use with Nimble API
|
|
47
|
+
email:
|
|
48
|
+
- p.dmitriev@nimble.com
|
|
49
|
+
executables: []
|
|
50
|
+
extensions: []
|
|
51
|
+
extra_rdoc_files: []
|
|
52
|
+
files:
|
|
53
|
+
- .gitignore
|
|
54
|
+
- Gemfile
|
|
55
|
+
- LICENSE.txt
|
|
56
|
+
- README.md
|
|
57
|
+
- Rakefile
|
|
58
|
+
- lib/omniauth-nimble.rb
|
|
59
|
+
- lib/omniauth-nimble/version.rb
|
|
60
|
+
- lib/omniauth/strategies/nimble.rb
|
|
61
|
+
- omniauth-nimble.gemspec
|
|
62
|
+
homepage: https://github.com/nimblecrm/omniauth-nimble
|
|
63
|
+
licenses: []
|
|
64
|
+
post_install_message:
|
|
65
|
+
rdoc_options: []
|
|
66
|
+
require_paths:
|
|
67
|
+
- lib
|
|
68
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
69
|
+
none: false
|
|
70
|
+
requirements:
|
|
71
|
+
- - ! '>='
|
|
72
|
+
- !ruby/object:Gem::Version
|
|
73
|
+
version: '0'
|
|
74
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
75
|
+
none: false
|
|
76
|
+
requirements:
|
|
77
|
+
- - ! '>='
|
|
78
|
+
- !ruby/object:Gem::Version
|
|
79
|
+
version: '0'
|
|
80
|
+
requirements: []
|
|
81
|
+
rubyforge_project:
|
|
82
|
+
rubygems_version: 1.8.23
|
|
83
|
+
signing_key:
|
|
84
|
+
specification_version: 3
|
|
85
|
+
summary: OAuth2 strategy to use with Nimble API
|
|
86
|
+
test_files: []
|