omniauth-stagebloc 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2387d9f9535a8fa8369dac71c266f0195e528bf1
4
- data.tar.gz: 6100165c31e31f3e2af1817275169174b49bd28b
3
+ metadata.gz: 9f5fe063e4a1fec23a27fda3586aa09f369bdc8f
4
+ data.tar.gz: 571124bcddae2be1b601dcc670df823fb4f35635
5
5
  SHA512:
6
- metadata.gz: 0fdcb819571605cea93e3febe24b7f20f966f619e9b5fd2928b2d3f46ddc345ceedf7c7af06a0967544774106a646a596cd96e33e3a770437ee98bd00b6e5cbe
7
- data.tar.gz: d08310d36a78b3f8a57c3d82c2a83b553402fc544ee94c711c48b817195e66ce23a0dc60a0a7fbdec36f7d8ac59becb60f0167d899fe1e4de052b5037b0005f6
6
+ metadata.gz: 3d39c94df95e90ae230ec1cec1a0e0ea3360f81ef14d73c79634a4d5def41d13be86c50f772d44c426caffcd220c2bbc1cf3df9e01249f63a7fe5b48e95652a8
7
+ data.tar.gz: d82065586e07a11ebaa6a1756783118c0617f1f59dde6542f28ec171d6a5323fd9061b3bc63aaefe1a123ce5ef8c5836d3451f4e53f01664df98fbbb990d6023
data/README.md CHANGED
@@ -1,6 +1,9 @@
1
- # Omniauth::Stagebloc
1
+ # OmniAuth::StageBloc
2
2
 
3
- TODO: Write a gem description
3
+ OmniAuth strategy for StageBloc.
4
+
5
+ <!-- trying to be funny, sort of -->
6
+ [![Code Climate](https://codeclimate.com/github/TheCodeDeli/omniauth-stagebloc/badges/gpa.svg)](https://codeclimate.com/github/TheCodeDeli/omniauth-stagebloc)
4
7
 
5
8
  ## Installation
6
9
 
@@ -14,17 +17,36 @@ And then execute:
14
17
 
15
18
  $ bundle
16
19
 
17
- Or install it yourself as:
20
+ ## Usage
18
21
 
19
- $ gem install omniauth-stagebloc
22
+ ### Devise
20
23
 
21
- ## Usage
24
+ ```ruby
25
+ config.omniauth :stagebloc, Rails.application.secrets.stageblock_client_id, Rails.application.secrets.stageblock_secret,
26
+ :parse => :stagebloc_parser
27
+ ```
28
+
29
+ ### OmniAuth (Rails)
22
30
 
23
- TODO: Write usage instructions here
31
+ ```ruby
32
+ Rails.application.config.middleware.use OmniAuth::Builder do
33
+ provider :stagebloc, ENV['STAGEBLOC_CLIENT_ID'], ENV['STAGEBLOC_SECRET'],
34
+ :parse => :stagebloc_parser
35
+ end
36
+ ```
37
+
38
+ ### OmniAuth (Rack)
39
+
40
+ ```ruby
41
+ use OmniAuth::Builder do
42
+ provider :stagebloc, ENV['STAGEBLOC_CLIENT_ID'], ENV['STAGEBLOC_SECRET'],
43
+ :parse => :stagebloc_parser
44
+ end
45
+ ```
24
46
 
25
47
  ## Contributing
26
48
 
27
- 1. Fork it ( https://github.com/[my-github-username]/omniauth-stagebloc/fork )
49
+ 1. Fork it ( https://github.com/TheCodeDeli/omniauth-stagebloc/fork )
28
50
  2. Create your feature branch (`git checkout -b my-new-feature`)
29
51
  3. Commit your changes (`git commit -am 'Add some feature'`)
30
52
  4. Push to the branch (`git push origin my-new-feature`)
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Stagebloc
3
- VERSION = "0.0.1"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  end
@@ -19,7 +19,17 @@ module OmniAuth
19
19
 
20
20
  info do
21
21
  {
22
- 'email' => raw_info['email']
22
+ 'id' => raw_info['id'],
23
+ 'url' => raw_info['url'],
24
+ 'created' => Time.parse(raw_info['created'] + ' UTC'),
25
+ 'name' => raw_info['name'],
26
+ 'username' => raw_info['username'],
27
+ 'bio' => raw_info['bio'],
28
+ 'color' => raw_info['color'],
29
+ 'birthday' => Time.parse(raw_info['birthday']),
30
+ 'gender' => raw_info['gender'],
31
+ 'email' => raw_info['email'],
32
+ 'photo' => raw_info['photo']
23
33
  }
24
34
  end
25
35
 
@@ -20,6 +20,7 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_development_dependency "bundler", "~> 1.7"
22
22
  spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "rspec", "~> 3.1"
23
24
 
24
25
  spec.add_dependency 'omniauth', '~> 1.2'
25
26
  spec.add_dependency 'omniauth-oauth2', '~> 1.0.3'
@@ -0,0 +1,77 @@
1
+ require "spec_helper"
2
+
3
+ module OmniAuth
4
+ module Strategies
5
+ describe Stagebloc do
6
+
7
+ let(:data) do
8
+ {
9
+ "id" => 8,
10
+ "url" => "https:\/\/stagebloc.dev\/user\/testuser",
11
+ "created" => "2009-10-27 14:29:16",
12
+ "name" => "Test User",
13
+ "username" => "testuser",
14
+ "bio" => "Biography here...",
15
+ "color" => "70,170,255",
16
+ "birthday" => "1995-07-05",
17
+ "gender" => "male",
18
+ "email" => "testuser@sb.com",
19
+ "photo" => {
20
+ "width" => 525,
21
+ "height" => 500,
22
+ "images" => {
23
+ "thumbnail_url" => "http://placekitten.com/300/300",
24
+ "small_url" => "http://placekitten.com/300/300",
25
+ "medium_url" => "http://placekitten.com/300/300",
26
+ "large_url" => "http://placekitten.com/300/300",
27
+ "original_url" => "http://placekitten.com/300/300"
28
+ }
29
+ }
30
+ }
31
+ end
32
+
33
+ subject do
34
+ subject = Stagebloc.new(data)
35
+ allow(subject).to receive(:raw_info) { data }
36
+ subject
37
+ end
38
+
39
+ describe "info" do
40
+ context "created" do
41
+ it "parses to UTC time" do
42
+ expect(subject.info['created']).to eq(Time.new(2009, 10, 27, 14, 29, 16, '+00:00'))
43
+ end
44
+ end
45
+
46
+ context "birthday" do
47
+ it "parses to date" do
48
+ expect(subject.info['birthday']).to eq(Time.new(1995, 07, 05))
49
+ end
50
+ end
51
+
52
+ it { should have_info('id', 8) }
53
+ it { should have_info('url', 'https://stagebloc.dev/user/testuser') }
54
+ it { should have_info('name', 'Test User') }
55
+ it { should have_info('username', 'testuser') }
56
+ it { should have_info('bio', 'Biography here...') }
57
+ it { should have_info('color', '70,170,255') }
58
+ it { should have_info('gender', 'male') }
59
+ it { should have_info('email', 'testuser@sb.com') }
60
+ it do
61
+ should have_info('photo', {
62
+ 'width' => 525,
63
+ 'height' => 500,
64
+ 'images' => {
65
+ "thumbnail_url" => "http://placekitten.com/300/300",
66
+ "small_url" => "http://placekitten.com/300/300",
67
+ "medium_url" => "http://placekitten.com/300/300",
68
+ "large_url" => "http://placekitten.com/300/300",
69
+ "original_url" => "http://placekitten.com/300/300"
70
+ }
71
+ })
72
+ end
73
+ end
74
+
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,12 @@
1
+ require 'omniauth'
2
+ require 'omniauth-stagebloc'
3
+
4
+ RSpec::Matchers.define :have_info do |field, value|
5
+ match do |actual|
6
+ actual.info[field] == value
7
+ end
8
+ failure_message do |actual|
9
+ "expected '#{field}' to equal #{value} but received #{actual.info.fetch(field, 'nil')}"
10
+ end
11
+ end
12
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-stagebloc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Baylor Rae'
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.1'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.1'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: omniauth
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -82,6 +96,8 @@ files:
82
96
  - lib/omniauth-stagebloc/version.rb
83
97
  - lib/omniauth/strategies/stagebloc.rb
84
98
  - omniauth-stagebloc.gemspec
99
+ - spec/lib/omniauth/strategies/stagebloc_spec.rb
100
+ - spec/spec_helper.rb
85
101
  homepage: http://github.com/TheCodeDeli/omniauth-stagebloc
86
102
  licenses:
87
103
  - MIT
@@ -106,5 +122,6 @@ rubygems_version: 2.2.2
106
122
  signing_key:
107
123
  specification_version: 4
108
124
  summary: OmniAuth strategy for Stagebloc.
109
- test_files: []
110
- has_rdoc:
125
+ test_files:
126
+ - spec/lib/omniauth/strategies/stagebloc_spec.rb
127
+ - spec/spec_helper.rb