artsy-auth 0.1.1 → 0.1.2

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: c3a31a866abd792a5c58653213d24593b9930d5e
4
- data.tar.gz: fdcc19637bc045820e591222e195cf46ec815d6e
3
+ metadata.gz: 206c2b3a6a177216b9512fd14c96c528fd8b5e8b
4
+ data.tar.gz: 48d7bf5ad6bf22e953b15ea18bfa22ce96a30439
5
5
  SHA512:
6
- metadata.gz: e4b2a50200544255fc2ebbf5d646286a65934baef8a2c6598ac7c0d600a1b75385c495ad9ae04d760aa3d35ffa6d8f4a8bd29b7e9829e002d0ecc0211bff0434
7
- data.tar.gz: 392c45f7b799b6c880a22f113314912bf311145b9bf085d2723480a75efa359db2462ec45d2ae4221bc38b07d28ee4165458db916061752ad9e23982640b7641
6
+ metadata.gz: 09319c87b4abf154de87b2089e1135fd01201462bc32f431643c00e451f8b1e62960f807d8500a2e28ac061e84d772b01cfd9a04e3776c3bfd630b11fec54a28
7
+ data.tar.gz: 8528b2ec18cdc418198146bb469526f78cf6a7ab3a0e62dc796fbbac0b0a20b01261f6c98970a721e7b1ac74ccfa9ecc667f1b859af2e94312908c26d5ed895d
data/README.md CHANGED
@@ -13,15 +13,18 @@ gem 'artsy-auth'
13
13
  Artsy Auth is based on [`Rails::Engine`](http://api.rubyonrails.org/classes/Rails/Engine.html).
14
14
 
15
15
  ### Configure
16
- Add `artsy_auth.rb` under `config/initializers`. We need to configure `ArtsyAuth` to use proper Artsy `application_id` and `application_secret`. Also it needs `artsy_url` which will be used to redirect `sign_out` to proper location.
16
+ Add `artsy_auth.rb` under `config/initializers`. We need to configure `ArtsyAuth` to use proper Artsy `application_id` and `application_secret`. Also it needs `artsy_url` which will be used to redirect `sign_out` to proper location, and `artsy_api_url` for login.
17
17
  `callback_url` defines after a successful omniauth handshake, where should we get redirected to.
18
18
 
19
19
  ```ruby
20
20
  # config/initalizers/artsy_auth.rb
21
- ArtsyAuth.config.artsy_url = 'https://stagingapi.artsy.net'
22
- ArtsyAuth.config.callback_url = '/admin'
23
- ArtsyAuth.config.application_id = '321322131'
24
- ArtsyAuth.config.application_secret = '123123asdasd'
21
+ ArtsyAuth.configure do |config|
22
+ config.artsy_api_url = 'https://stagingapi.artsy.net' # required
23
+ config.artsy_url = 'https://staging.artsy.net' # required
24
+ config.callback_url = '/admin' # optional
25
+ config.application_id = '321322131' # required
26
+ config.application_secret = '123123asdasd' # required
27
+ end
25
28
  ```
26
29
 
27
30
  You also need to mount session related endpoints to your app, in your `config/routes.rb`. Add following line to your current routes.
@@ -56,4 +59,5 @@ end
56
59
  * Fork the project.
57
60
  * Make your feature addition or bug fix with tests.
58
61
  * Update CHANGELOG.
59
- * Send a pull request. Bonus points for topic branches.
62
+ * Send a pull request. Bonus points for topic branches.
63
+
@@ -0,0 +1,3 @@
1
+ OmniAuth::Artsy.configure do |config|
2
+ config.artsy_api_url = ArtsyAuth.config.artsy_api_url
3
+ end
@@ -1,10 +1,31 @@
1
1
  module ArtsyAuth
2
- mattr_accessor :config
3
- end
2
+ module Config
3
+ extend self
4
+
5
+ attr_accessor :artsy_api_url
6
+ attr_accessor :artsy_url
7
+ attr_accessor :application_id
8
+ attr_accessor :application_secret
9
+ attr_accessor :callback_url
10
+
11
+ def reset
12
+ self.artsy_api_url = nil
13
+ self.artsy_url = nil
14
+ self.callback_url = '/'
15
+ self.application_id = nil
16
+ self.application_secret = nil
17
+ end
4
18
 
5
- ArtsyAuth.config = OpenStruct.new(
6
- artsy_url: nil,
7
- callback_url: '/',
8
- application_id: nil,
9
- application_secret: nil
10
- )
19
+ reset
20
+ end
21
+
22
+ class << self
23
+ def configure
24
+ block_given? ? yield(Config) : Config
25
+ end
26
+
27
+ def config
28
+ Config
29
+ end
30
+ end
31
+ end
@@ -1,3 +1,3 @@
1
1
  module ArtsyAuth
2
- VERSION = '0.1.1'.freeze
2
+ VERSION = '0.1.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: artsy-auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artsy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-30 00:00:00.000000000 Z
11
+ date: 2017-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth-oauth2
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: 0.2.1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: 0.2.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rails
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -132,6 +132,7 @@ files:
132
132
  - README.md
133
133
  - Rakefile
134
134
  - config/initializers/omniauth.rb
135
+ - config/initializers/omniauth_artsy.rb
135
136
  - config/routes.rb
136
137
  - lib/artsy-auth.rb
137
138
  - lib/artsy-auth/application_controller.rb
@@ -158,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
158
159
  version: '0'
159
160
  requirements: []
160
161
  rubyforge_project:
161
- rubygems_version: 2.4.8
162
+ rubygems_version: 2.6.11
162
163
  signing_key:
163
164
  specification_version: 4
164
165
  summary: ArtsyAuth is a rails based gem that adds Artsy authentication with authorization