omniauth-buffer 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ *.gem
2
+ Gemfile.lock
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+ gem 'rake'
3
+ gemspec
data/README.md ADDED
@@ -0,0 +1,33 @@
1
+ OmniAuth Buffer
2
+ ================
3
+ Work in Progress
4
+
5
+ This gem is an OmniAuth Strategy for the [Buffer API](http://bufferapp.com/developers/api) which uses OAuth 2.0
6
+
7
+ Usage
8
+ -----
9
+
10
+ Add the strategy to your `Gemfile` alongside OmniAuth:
11
+
12
+ ```ruby
13
+ gem 'omniauth'
14
+ gem 'omniauth-buffer'
15
+ ```
16
+
17
+ Then integrate the strategy into your middleware:
18
+
19
+ ```ruby
20
+ use OmniAuth::Builder do
21
+ provider :buffer, ENV['BUFFER_KEY'], ENV['BUFFER_SECRET']
22
+ end
23
+ ```
24
+
25
+ In Rails, you'll want to add to the middleware stack:
26
+
27
+ ```ruby
28
+ Rails.application.config.middleware.use OmniAuth::Builder do
29
+ provider :buffer, ENV['BUFFER_KEY'], ENV['BUFFER_SECRET']
30
+ end
31
+ ```
32
+
33
+ For additional information, refer to the [OmniAuth wiki](https://github.com/intridea/omniauth/wiki).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,34 @@
1
+ require 'omniauth-oauth2'
2
+ require 'multi_json'
3
+
4
+ module OmniAuth
5
+ module Strategies
6
+ class Buffer < OmniAuth::Strategies::OAuth2
7
+ option :name, 'buffer'
8
+ option :client_options, {
9
+ :site => 'http://api.buffer.com',
10
+ :authorize_url => 'https://bufferapp.com/oauth2/authorize',
11
+ :token_url => 'https://api.bufferapp.com/1/oauth2/token.json'
12
+ }
13
+
14
+ uid { raw_info['id'] }
15
+
16
+ info do
17
+ {
18
+ :referral_link => raw_info['referral_link']
19
+ }
20
+ end
21
+
22
+ extra do
23
+ { :raw_info => raw_info }
24
+ end
25
+
26
+ def raw_info
27
+ access_token.options[:mode] = :query
28
+ access_token.options[:param_name] = :access_token
29
+ @raw_info ||= MultiJson.load(access_token.get('https://api.bufferapp.com/1/user.json').body)
30
+ end
31
+
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,5 @@
1
+ module OmniAuth
2
+ module Buffer
3
+ VERSION = "0.0.5"
4
+ end
5
+ end
@@ -0,0 +1 @@
1
+ require 'omniauth/strategies/buffer'
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/omniauth-buffer/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.name = "omniauth-buffer"
6
+ gem.version = OmniAuth::Buffer::VERSION
7
+ gem.authors = ["Raison Dsouza"]
8
+ gem.email = ["raisondsouza@gmail.com"]
9
+ gem.description = "Omniauth strategy for Buffer"
10
+ gem.summary = "Omniauth strategy for Buffer"
11
+ gem.homepage = "https://github.com/rdsoze/omniauth-buffer.git"
12
+
13
+ gem.files = `git ls-files`.split($\)
14
+ gem.test_files = `git ls-files -- {spec}/*`.split("\n")
15
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
16
+ gem.require_paths = ["lib"]
17
+
18
+ gem.add_dependency 'multi_json', '~> 1.3'
19
+ gem.add_development_dependency 'rspec', '~> 2.10'
20
+ gem.add_runtime_dependency 'omniauth-oauth2', '~> 1.0.2'
21
+ end
@@ -0,0 +1,25 @@
1
+ require 'spec_helper'
2
+
3
+ describe OmniAuth::Strategies::Buffer do
4
+ subject do
5
+ OmniAuth::Strategies::Buffer.new({})
6
+ end
7
+
8
+ context "client options" do
9
+ it 'should have correct name' do
10
+ subject.options.name.should eq("buffer")
11
+ end
12
+
13
+ it 'should have correct site' do
14
+ subject.options.client_options.site.should eq('http://api.buffer.com')
15
+ end
16
+
17
+ it 'should have correct authorize url' do
18
+ subject.options.client_options.authorize_url.should eq('https://bufferapp.com/oauth2/authorize')
19
+ end
20
+
21
+ it 'should have correct token url' do
22
+ subject.options.client_options.token_url.should eq('https://api.bufferapp.com/1/oauth2/token.json')
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,7 @@
1
+ require 'bundler/setup'
2
+ require 'rspec'
3
+ require 'omniauth'
4
+ require 'omniauth-buffer'
5
+
6
+ RSpec.configure do |config|
7
+ end
metadata ADDED
@@ -0,0 +1,89 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-buffer
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.5
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Raison Dsouza
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-07-04 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: multi_json
16
+ requirement: &72621510 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '1.3'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *72621510
25
+ - !ruby/object:Gem::Dependency
26
+ name: rspec
27
+ requirement: &72620930 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: '2.10'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *72620930
36
+ - !ruby/object:Gem::Dependency
37
+ name: omniauth-oauth2
38
+ requirement: &72620310 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: 1.0.2
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *72620310
47
+ description: Omniauth strategy for Buffer
48
+ email:
49
+ - raisondsouza@gmail.com
50
+ executables: []
51
+ extensions: []
52
+ extra_rdoc_files: []
53
+ files:
54
+ - .gitignore
55
+ - .rspec
56
+ - Gemfile
57
+ - README.md
58
+ - Rakefile
59
+ - lib/omniauth-buffer.rb
60
+ - lib/omniauth-buffer/version.rb
61
+ - lib/omniauth/strategies/buffer.rb
62
+ - omniauth-buffer.gemspec
63
+ - spec/omniauth/strategies/buffer_spec.rb
64
+ - spec/spec_helper.rb
65
+ homepage: https://github.com/rdsoze/omniauth-buffer.git
66
+ licenses: []
67
+ post_install_message:
68
+ rdoc_options: []
69
+ require_paths:
70
+ - lib
71
+ required_ruby_version: !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ required_rubygems_version: !ruby/object:Gem::Requirement
78
+ none: false
79
+ requirements:
80
+ - - ! '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ requirements: []
84
+ rubyforge_project:
85
+ rubygems_version: 1.8.10
86
+ signing_key:
87
+ specification_version: 3
88
+ summary: Omniauth strategy for Buffer
89
+ test_files: []