omniauth-artsy 0.2.0 → 0.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 84c99fab0ddb785b438967eb1dbaf35ec62ed53b
4
- data.tar.gz: 10d61d64a4a3cb913d72cc62ee0bab142bfe8042
3
+ metadata.gz: 72a0934cb2f200b475f98786ff00b6f6e941e0ea
4
+ data.tar.gz: 94efa9e5725f75610d36174e15770ed27582c7fe
5
5
  SHA512:
6
- metadata.gz: 2d56f1e29e8254e78ee73ab138454badb183d099beae4df6cd7b544dc240fa5e5291e3a828036c52d91b59301a821796e4c8e2507aec10e56f7582ff12a6727f
7
- data.tar.gz: 72a3ccaa269c35c9931b7bf87f328653edf86d1902944aaca8407ba0d42f67b2a462fb2e1d8c8e6fc4631868a70cf74ca3dbd2ee4e18f0b8d7d792e477b6e3ec
6
+ metadata.gz: e3291407926b8f67989fd079e52e201f0c3d59f94a817a8631788dfc906dfe9ae0b2ed982ed7c1af757e5b4f2bcd1d1909dc5acd146d389d4ef440785109ea58
7
+ data.tar.gz: baf43adc69c2258fff4a456c9ab27ec25606c283a4f26fc1fa200bccfdba2c310223a6330e8d5f9f0c713dd26b4d5da2d47ad8d6636942b5482ed2557ed5d3b2
data/.rubocop_todo.yml CHANGED
@@ -1,25 +1,47 @@
1
- # This configuration was generated by `rubocop --auto-gen-config`
2
- # on 2014-08-25 15:35:38 -0400 using RuboCop version 0.25.0.
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2017-03-31 17:08:47 -0400 using RuboCop version 0.48.0.
3
4
  # The point is for the user to remove these configuration records
4
5
  # one by one as the offenses are removed from the code base.
5
6
  # Note that changes in the inspected code, or installation of new
6
7
  # versions of RuboCop, may require this file to be generated again.
7
8
 
9
+ # Offense count: 2
10
+ # Configuration parameters: CountComments, ExcludedMethods.
11
+ Metrics/BlockLength:
12
+ Max: 64
13
+
8
14
  # Offense count: 8
9
- # Configuration parameters: AllowURI.
15
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
16
+ # URISchemes: http, https
10
17
  Metrics/LineLength:
11
18
  Max: 154
12
19
 
13
- # Offense count: 2
20
+ # Offense count: 3
14
21
  Style/Documentation:
15
- Enabled: false
22
+ Exclude:
23
+ - 'spec/**/*'
24
+ - 'test/**/*'
25
+ - 'lib/omniauth-artsy/config.rb'
26
+ - 'lib/omniauth/strategies/artsy.rb'
27
+
28
+ # Offense count: 1
29
+ # Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms.
30
+ # AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
31
+ Style/FileName:
32
+ Exclude:
33
+ - 'lib/omniauth-artsy.rb'
16
34
 
17
- # Offense count: 7
35
+ # Offense count: 1
18
36
  # Configuration parameters: EnforcedStyle, SupportedStyles.
19
- Style/Encoding:
20
- Enabled: false
37
+ # SupportedStyles: module_function, extend_self
38
+ Style/ModuleFunction:
39
+ Exclude:
40
+ - 'lib/omniauth-artsy/config.rb'
21
41
 
22
42
  # Offense count: 1
23
- # Configuration parameters: Exclude.
24
- Style/FileName:
25
- Enabled: false
43
+ # Cop supports --auto-correct.
44
+ # Configuration parameters: SupportedStyles.
45
+ # SupportedStyles: percent, brackets
46
+ Style/SymbolArray:
47
+ EnforcedStyle: brackets
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ 0.2.2 (Next)
2
+ ============
3
+
4
+ * Your contribution here.
5
+
6
+ 0.2.1
7
+ ============
8
+
9
+ * [#6](https://github.com/artsy/omniauth-artsy/pull/6): Add config so we can configure/initialize `OmniAuth::Artsy` - [@ashkan18](https://github.com/ashkan18).
10
+
1
11
  0.2.0 (5/4/2016)
2
12
  ================
3
13
 
data/README.md CHANGED
@@ -28,7 +28,17 @@ end
28
28
 
29
29
  #### Configuration
30
30
 
31
- Set `ENV['ARTSY_API_URL']` to the location of the Artsy API, typically *https://api.artsy.net* in production. Defaults to *http://localhost:3000*.
31
+ ##### Configure in your app
32
+ Add `omniauth_artsy.rb` to your `config/initializers` and set `artsy_api_url`.
33
+ ```ruby
34
+ # config/initializers/omniauth_artsy.rb
35
+ OmniAuth::Artsy.configure do |config|
36
+ config.artsy_api_url = ENV['ARTSY_API_URL']
37
+ end
38
+ ```
39
+
40
+ ##### Using ENV
41
+ Set `ENV['ARTSY_API_URL']` to the location of the Artsy API, typically *https://api.artsy.net* in production.
32
42
 
33
43
  ### License
34
44
 
@@ -1,2 +1,3 @@
1
1
  require 'omniauth-artsy/version'
2
+ require 'omniauth-artsy/config'
2
3
  require 'omniauth/strategies/artsy'
@@ -0,0 +1,25 @@
1
+ module OmniAuth
2
+ module Artsy
3
+ module Config
4
+ extend self
5
+
6
+ attr_accessor :artsy_api_url
7
+
8
+ def reset
9
+ self.artsy_api_url = nil
10
+ end
11
+
12
+ reset
13
+ end
14
+
15
+ class << self
16
+ def configure
17
+ block_given? ? yield(Config) : Config
18
+ end
19
+
20
+ def config
21
+ Config
22
+ end
23
+ end
24
+ end
25
+ end
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Artsy
3
- VERSION = '0.2.0'
3
+ VERSION = '0.2.1'.freeze
4
4
  end
5
5
  end
@@ -4,7 +4,7 @@ module OmniAuth
4
4
  module Strategies
5
5
  class Artsy < OmniAuth::Strategies::OAuth2
6
6
  option :client_options,
7
- site: ENV['ARTSY_API_URL'] || ENV['gravity_url'] || 'http://localhost:3000',
7
+ site: OmniAuth::Artsy.config.artsy_api_url || ENV['ARTSY_API_URL'] || ENV['gravity_url'],
8
8
  authorize_url: '/oauth2/authorize?scope=offline_access&response_type=code',
9
9
  token_url: '/oauth2/access_token?scope=offline_access&response_type=code&grant_type=authorization_code'
10
10
 
@@ -1,4 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
+
2
3
  $LOAD_PATH.push File.expand_path('../lib', __FILE__)
3
4
  require 'omniauth-artsy/version'
4
5
 
@@ -21,5 +22,5 @@ Gem::Specification.new do |s|
21
22
  s.add_development_dependency 'rake'
22
23
  s.add_development_dependency 'rspec'
23
24
  s.add_development_dependency 'webmock'
24
- s.add_development_dependency 'rubocop', '0.25.0'
25
+ s.add_development_dependency 'rubocop'
25
26
  end
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ describe OmniAuth::Artsy::Config do
4
+ describe '#configure' do
5
+ before do
6
+ OmniAuth::Artsy.configure do |config|
7
+ config.artsy_api_url = 'http://localhost:3000/api'
8
+ end
9
+ end
10
+ after do
11
+ OmniAuth::Artsy.config.reset
12
+ end
13
+ it 'sets token' do
14
+ expect(OmniAuth::Artsy.config.artsy_api_url).to eq 'http://localhost:3000/api'
15
+ end
16
+ end
17
+ end
@@ -22,8 +22,8 @@ describe OmniAuth::Strategies::Artsy do
22
22
  end
23
23
 
24
24
  describe '#client_options' do
25
- it 'has correct Artsy API URL' do
26
- expect(subject.options.client_options.site).to eq('http://localhost:3000')
25
+ it 'returns nil for Artsy API URL without setting' do
26
+ expect(subject.options.client_options.site).to be_nil
27
27
  end
28
28
 
29
29
  it 'has correct authorize url' do
data/spec/spec_helper.rb CHANGED
@@ -5,6 +5,4 @@ require 'omniauth-artsy'
5
5
  require 'rspec'
6
6
  require 'webmock/rspec'
7
7
 
8
- RSpec.configure do |config|
9
- config.raise_errors_for_deprecations!
10
- end
8
+ RSpec.configure(&:raise_errors_for_deprecations!)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-artsy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dylan Fareed
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-04 00:00:00.000000000 Z
11
+ date: 2017-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth-oauth2
@@ -70,16 +70,16 @@ dependencies:
70
70
  name: rubocop
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: 0.25.0
75
+ version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: 0.25.0
82
+ version: '0'
83
83
  description: 'Omniauth plugin for Artsy authentication. '
84
84
  email:
85
85
  - dylan@artsy.net
@@ -98,9 +98,11 @@ files:
98
98
  - README.md
99
99
  - Rakefile
100
100
  - lib/omniauth-artsy.rb
101
+ - lib/omniauth-artsy/config.rb
101
102
  - lib/omniauth-artsy/version.rb
102
103
  - lib/omniauth/strategies/artsy.rb
103
104
  - omniauth-artsy.gemspec
105
+ - spec/lib/config_spec.rb
104
106
  - spec/omniauth/strategies/artsy_spec.rb
105
107
  - spec/spec_helper.rb
106
108
  homepage: https://github.com/artsy/omniauth-artsy
@@ -123,10 +125,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
125
  version: '0'
124
126
  requirements: []
125
127
  rubyforge_project:
126
- rubygems_version: 2.4.8
128
+ rubygems_version: 2.6.11
127
129
  signing_key:
128
130
  specification_version: 4
129
131
  summary: Omniauth plugin for Artsy authentication.
130
132
  test_files:
133
+ - spec/lib/config_spec.rb
131
134
  - spec/omniauth/strategies/artsy_spec.rb
132
135
  - spec/spec_helper.rb