omniauth-pushbullet 0.1.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 +10 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +58 -0
- data/Rakefile +1 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/omniauth-pushbullet.rb +2 -0
- data/lib/omniauth-pushbullet/version.rb +5 -0
- data/lib/omniauth/strategies/pushbullet.rb +54 -0
- data/omniauth-pushbullet.gemspec +26 -0
- metadata +99 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 35e9621fc96af78074a5cf7137c3d35d7af30fdb
|
4
|
+
data.tar.gz: f536cef13e6debd228c93a6d15be171817cd4505
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8a7408d06d02ebbf2f51211f7a8501d4347c7189b47fd26d40867e720e0d999948d67463410c8e198522a4b4bcad166327de2b0fb6d027876d087b41b3ecfba5
|
7
|
+
data.tar.gz: fe8b547ab0a3a95435fe9bce60dea9f3ff9a772142ed6124593d2ce25d55485cdb76e5f4ad5f7a334a4eb6e10626f1d20f72b1b4273c9c2d0eb31a88048ab3c6
|
data/.gitignore
ADDED
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
omniauth-pushbullet
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.3
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2016 Brandon Rice
|
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 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,
|
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 THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
# OmniAuth Pushbullet
|
2
|
+
|
3
|
+
This gem contains an OmniAuth strategy for [Pushbullet](https://www.pushbullet.com/) using their OAuth2 authentication API.
|
4
|
+
|
5
|
+
Before using this gem, you will need to register an application with Pushbullet through their website.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'omniauth-pushbullet'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install omniauth-pushbullet
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
Integrate the strategy as middleware in any Rack app by editing `config.ru`:
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
use OmniAuth::Builder do
|
29
|
+
provider :pushbullet, ENV['CLIENT_ID'], ENV['CLIENT_SECRET']
|
30
|
+
end
|
31
|
+
```
|
32
|
+
|
33
|
+
If you're using Rails, there's a slightly different variation. Add the following to a file of your choice in config/initializers:
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
37
|
+
provider :pushbullet, ENV['CLIENT_ID'], ENV['CLIENT_SECRET']
|
38
|
+
end
|
39
|
+
```
|
40
|
+
|
41
|
+
The `CLIENT_ID` and `CLIENT_SECRET` are obtained from Pushbullet after registering your application.
|
42
|
+
|
43
|
+
The remaining integration steps are explained in the [README for OmniAuth](https://github.com/intridea/omniauth#integrating-omniauth-into-your-application)
|
44
|
+
|
45
|
+
## Development
|
46
|
+
|
47
|
+
After checking out the repo, run `bin/setup` or `bundle install` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
48
|
+
|
49
|
+
To install the gem with your local changes onto your machine, run `bundle exec rake install`.
|
50
|
+
|
51
|
+
## Contributing
|
52
|
+
|
53
|
+
1. Fork it ( http://github.com/nevern02/omniauth-pushbullet/fork )
|
54
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
55
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
56
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
57
|
+
5. Create new Pull Request
|
58
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "omniauth-pushbullet"
|
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
|
data/bin/setup
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'omniauth-oauth2'
|
2
|
+
require 'net/http'
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
module OmniAuth
|
6
|
+
module Strategies
|
7
|
+
class Pushbullet < OmniAuth::Strategies::OAuth2
|
8
|
+
BASE_URL = 'https://www.pushbullet.com'
|
9
|
+
API_URL = 'https://api.pushbullet.com'
|
10
|
+
|
11
|
+
option :name, 'pushbullet'
|
12
|
+
|
13
|
+
option :client_options, {
|
14
|
+
:site => BASE_URL,
|
15
|
+
:authorize_url => "#{BASE_URL}/authorize",
|
16
|
+
:token_url => "#{API_URL}/oauth2/token"
|
17
|
+
}
|
18
|
+
|
19
|
+
uid do
|
20
|
+
raw_data.delete('iden')
|
21
|
+
end
|
22
|
+
|
23
|
+
info do
|
24
|
+
{
|
25
|
+
:name => raw_data.delete('name'),
|
26
|
+
:email => raw_data.delete('email'),
|
27
|
+
:image => raw_data.delete('image_url')
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
extra do
|
32
|
+
raw_data
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def raw_data
|
38
|
+
return @data if @data
|
39
|
+
|
40
|
+
uri = URI.parse("#{API_URL}/v2/users/me")
|
41
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
42
|
+
request = Net::HTTP::Get.new(uri.request_uri)
|
43
|
+
|
44
|
+
http.use_ssl = true
|
45
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
46
|
+
|
47
|
+
request['Content-Type'] = 'application/json'
|
48
|
+
request['Access-Token'] = access_token.token
|
49
|
+
|
50
|
+
@data = JSON.parse(http.request(request).body)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'omniauth-pushbullet/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "omniauth-pushbullet"
|
8
|
+
spec.version = Omniauth::Pushbullet::VERSION
|
9
|
+
spec.authors = ["Brandon Rice"]
|
10
|
+
spec.email = ["brandon@blrice.net"]
|
11
|
+
spec.license = 'MIT'
|
12
|
+
|
13
|
+
spec.summary = %q{Pushbullet OAuth2 strategy for OmniAuth}
|
14
|
+
spec.description = %q{Pushbullet OAuth2 strategy for OmniAuth}
|
15
|
+
spec.homepage = "https://github.com/nevern02/omniauth-pushbullet"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_dependency "omniauth-oauth2", "~> 1.4"
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.11"
|
25
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-pushbullet
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Brandon Rice
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-04-03 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.4'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.4'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.11'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.11'
|
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
|
+
description: Pushbullet OAuth2 strategy for OmniAuth
|
56
|
+
email:
|
57
|
+
- brandon@blrice.net
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- ".ruby-gemset"
|
64
|
+
- ".ruby-version"
|
65
|
+
- Gemfile
|
66
|
+
- LICENSE.txt
|
67
|
+
- README.md
|
68
|
+
- Rakefile
|
69
|
+
- bin/console
|
70
|
+
- bin/setup
|
71
|
+
- lib/omniauth-pushbullet.rb
|
72
|
+
- lib/omniauth-pushbullet/version.rb
|
73
|
+
- lib/omniauth/strategies/pushbullet.rb
|
74
|
+
- omniauth-pushbullet.gemspec
|
75
|
+
homepage: https://github.com/nevern02/omniauth-pushbullet
|
76
|
+
licenses:
|
77
|
+
- MIT
|
78
|
+
metadata: {}
|
79
|
+
post_install_message:
|
80
|
+
rdoc_options: []
|
81
|
+
require_paths:
|
82
|
+
- lib
|
83
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
requirements: []
|
94
|
+
rubyforge_project:
|
95
|
+
rubygems_version: 2.5.1
|
96
|
+
signing_key:
|
97
|
+
specification_version: 4
|
98
|
+
summary: Pushbullet OAuth2 strategy for OmniAuth
|
99
|
+
test_files: []
|