simpleapikeyengine 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: 07f5b168e790607fcc0d8b35cbdc24662e615050
4
- data.tar.gz: 38b118f1e391d69349db8c68b5eddd2d92310d60
3
+ metadata.gz: 77a89d0e7f1170ed59fc0397aaacf0d5e4036384
4
+ data.tar.gz: 761677a6bcd15363d6fcbb2959c383d3f9f35610
5
5
  SHA512:
6
- metadata.gz: 6a2c7b750b0da1e802aea29354ea5252c661f87b02f9e05b45d27c26ed7d02ab15a47ad6dc52d3e16adedf76599ccb64e9c7de4536e692c5869bbf434e966c0b
7
- data.tar.gz: 408e4efec0d56f57704bccd0dfdec01bdfa8f85228554c3f5c45ff2ae49b5a656153e9291af9b5849a8f5b0808616117054ea10f3d7e64b279c8ea6c4188b37d
6
+ metadata.gz: 8652dbae145f1dca77021ae4936edf96a01d3340e492cadec95c2f4f8931ade4631874ca7b02fdcbe5dba26ed6d1a9e0ccdace3073fb74ea24fa794e56771017
7
+ data.tar.gz: 0620d5658db22d5f69e7989c7107bf0ab33e93d821ebf5acef394cddb123d495ae9ab159563bddfdb4a0f68d2b6b38dcc0d59ee69678957542272d52e666f26f
@@ -1,5 +1,6 @@
1
1
  module SimpleApiKeyEngine
2
2
  class ApiKey < ActiveRecord::Base
3
+ belongs_to :authentication, class_name: 'SimpleApiKeyEngine::Authentication'
3
4
  before_create :generate_token
4
5
  before_create :set_expiration
5
6
 
@@ -1,5 +1,6 @@
1
1
  module SimpleApiKeyEngine
2
2
  class Authentication < ActiveRecord::Base
3
+ has_many :api_keys, class_name: 'SimpleApiKeyEngine::ApiKey', dependent: :destroy
3
4
  store :auth_hash
4
5
 
5
6
  class << self
@@ -10,9 +11,9 @@ module SimpleApiKeyEngine
10
11
  def activate(request, &block)
11
12
  authentication = auth(request, &block)
12
13
  return nil unless authentication
13
- SimpleApiKeyEngine::ApiKey.create!(provider: authentication.provider,
14
- user_type: authentication.user_type,
15
- user_ident: authentication.user_ident)
14
+ api_keys.create!(provider: authentication.provider,
15
+ user_type: authentication.user_type,
16
+ user_ident: authentication.user_ident)
16
17
  end
17
18
 
18
19
  private
@@ -0,0 +1,7 @@
1
+ class AddAuthenticationIdToSimpleApiKeyEngineApiKeys < ActiveRecord::Migration
2
+ def change
3
+ change_table :simple_api_key_engine_api_keys do |t|
4
+ t.references :authentication
5
+ end
6
+ end
7
+ end
@@ -1,3 +1,3 @@
1
1
  module SimpleApiKeyEngine
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simpleapikeyengine
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
  - Yuichi Takeuchi
@@ -69,6 +69,7 @@ files:
69
69
  - db/migrate/20141110041340_create_simple_api_key_engine_authentications.rb
70
70
  - db/migrate/20141117060900_add_expires_at_to_simple_api_key_engine_authentications.rb
71
71
  - db/migrate/20150530161500_add_provider_to_simple_api_key_engine_api_keys.rb
72
+ - db/migrate/20150530175800_add_authentication_id_to_simple_api_key_engine_api_keys.rb
72
73
  - lib/simpleapikeyengine.rb
73
74
  - lib/simpleapikeyengine/engine.rb
74
75
  - lib/simpleapikeyengine/provider_configuration.rb