omniauth-shoplo 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d9c81c00ea0cac69a480aa28eb384b10a6799020
4
+ data.tar.gz: 90ccec5d2eb417cb0411b9423658c79d620f3313
5
+ SHA512:
6
+ metadata.gz: 84df7c65a7b3c62856dfd810ee6063ee70f7d2440a25d70df09ed6cbbe8e64ef300427ff33551247d1f4bae541be3f0d23929405928b150f142be89d7a53ab5e
7
+ data.tar.gz: 232f0856ae3d0b98a8a9499a37389aa1c83cb0ae0e547350bdba3410dfdefe2bf6288f1c6bc4ab8e803d6972bc3faff7bf4b93390f875811c5e1a219ff337fd2
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ coverage
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ --format=documentation
3
+ --backtrace
data/.travis.yml ADDED
@@ -0,0 +1,2 @@
1
+ rvm:
2
+ - 1.9.3
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem 'rake'
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1 @@
1
+ # OmniAuth Shoplo strategy
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env rake
2
+
3
+ require 'bundler'
4
+ Bundler::GemHelper.install_tasks
5
+
6
+ require 'rspec/core/rake_task'
7
+ RSpec::Core::RakeTask.new(:spec)
8
+
9
+ task :default => :spec
10
+ task :test => :spec
@@ -0,0 +1,2 @@
1
+ require "omniauth-shoplo/version"
2
+ require "omniauth/strategies/shoplo"
@@ -0,0 +1,5 @@
1
+ module OmniAuth
2
+ module Shoplo
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,41 @@
1
+ require 'omniauth-oauth'
2
+ require 'multi_json'
3
+
4
+ module OmniAuth
5
+ module Strategies
6
+ class Shoplo < OmniAuth::Strategies::OAuth
7
+
8
+ option :name, 'shoplo'
9
+
10
+ option :client_options, {
11
+ :site => 'http://api.shoplo.com',
12
+ :authorize_path => '/services/oauth/authorize',
13
+ :access_token_path => '/services/oauth/access_token',
14
+ :request_token_path => '/services/oauth/request_token'
15
+ }
16
+
17
+ uid { raw_info['id'] }
18
+
19
+ info do
20
+ {
21
+ :id => raw_info['id'],
22
+ :name => raw_info['name'],
23
+ :domain => raw_info['domain'],
24
+ }
25
+ end
26
+
27
+ extra do
28
+ {
29
+ 'raw_info' => raw_info['shop']
30
+ }
31
+ end
32
+
33
+ def raw_info
34
+ @raw_info ||= MultiJson.decode(access_token.get('/services/shop').body)
35
+ rescue ::Errno::ETIMEDOUT
36
+ raise ::Timeout::Error
37
+ end
38
+
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "omniauth-shoplo/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "omniauth-shoplo"
7
+ s.version = OmniAuth::Shoplo::VERSION
8
+ s.authors = ["Mateusz Sojda"]
9
+ s.email = ["mateusz@sojda.pl"]
10
+ s.homepage = "https://github.com/msojda/omniauth-shoplo"
11
+ s.summary = %q{OmniAuth strategy for Shoplo}
12
+ s.description = %q{OmniAuth strategy for Shoplo}
13
+ s.license = "MIT"
14
+
15
+ s.files = `git ls-files`.split("\n")
16
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
+ s.require_paths = ["lib"]
19
+
20
+ s.add_dependency 'multi_json', '~> 1.3'
21
+ s.add_runtime_dependency 'omniauth-oauth', '~> 1.0'
22
+ s.add_development_dependency 'rspec', '~> 2.7'
23
+ s.add_development_dependency 'rack-test'
24
+ s.add_development_dependency 'simplecov'
25
+ s.add_development_dependency 'webmock'
26
+ end
@@ -0,0 +1,29 @@
1
+ require 'spec_helper'
2
+
3
+ describe OmniAuth::Strategies::Shoplo do
4
+ subject do
5
+ OmniAuth::Strategies::Shoplo.new({})
6
+ end
7
+
8
+ context 'client options' do
9
+ it 'should have correct name' do
10
+ expect(subject.options.name).to eq('shoplo')
11
+ end
12
+
13
+ it 'should have correct site' do
14
+ expect(subject.options.client_options.site).to eq('http://api.shoplo.com')
15
+ end
16
+
17
+ it 'should have correct authorize url' do
18
+ expect(subject.options.client_options.authorize_path).to eq('/services/oauth/authorize')
19
+ end
20
+
21
+ it 'should have correct access token url' do
22
+ expect(subject.options.client_options.access_token_path).to eq('/services/oauth/access_token')
23
+ end
24
+
25
+ it 'should have correct request token url' do
26
+ expect(subject.options.client_options.request_token_path).to eq('/services/oauth/request_token')
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,18 @@
1
+ $:.unshift File.expand_path('..', __FILE__)
2
+ $:.unshift File.expand_path('../../lib', __FILE__)
3
+ require 'simplecov'
4
+ SimpleCov.start
5
+ require 'rspec'
6
+ require 'rack/test'
7
+ require 'webmock/rspec'
8
+ require 'omniauth'
9
+ require 'omniauth-shoplo'
10
+
11
+ RSpec.configure do |config|
12
+ config.include WebMock::API
13
+ config.include Rack::Test::Methods
14
+ config.extend OmniAuth::Test::StrategyMacros, :type => :strategy
15
+ config.expect_with :rspec do |c|
16
+ c.syntax = :expect
17
+ end
18
+ end
metadata ADDED
@@ -0,0 +1,142 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-shoplo
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Mateusz Sojda
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-09-14 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: multi_json
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: omniauth-oauth
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '1.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.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: '2.7'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '2.7'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rack-test
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: simplecov
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: webmock
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: OmniAuth strategy for Shoplo
98
+ email:
99
+ - mateusz@sojda.pl
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - .gitignore
105
+ - .rspec
106
+ - .travis.yml
107
+ - Gemfile
108
+ - README.md
109
+ - Rakefile
110
+ - lib/omniauth-shoplo.rb
111
+ - lib/omniauth-shoplo/version.rb
112
+ - lib/omniauth/strategies/shoplo.rb
113
+ - omniauth-shoplo.gemspec
114
+ - spec/omniauth/strategies/shoplo_spec.rb
115
+ - spec/spec_helper.rb
116
+ homepage: https://github.com/msojda/omniauth-shoplo
117
+ licenses:
118
+ - MIT
119
+ metadata: {}
120
+ post_install_message:
121
+ rdoc_options: []
122
+ require_paths:
123
+ - lib
124
+ required_ruby_version: !ruby/object:Gem::Requirement
125
+ requirements:
126
+ - - '>='
127
+ - !ruby/object:Gem::Version
128
+ version: '0'
129
+ required_rubygems_version: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - '>='
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ requirements: []
135
+ rubyforge_project:
136
+ rubygems_version: 2.0.14
137
+ signing_key:
138
+ specification_version: 4
139
+ summary: OmniAuth strategy for Shoplo
140
+ test_files:
141
+ - spec/omniauth/strategies/shoplo_spec.rb
142
+ - spec/spec_helper.rb