zuora_connect 0.0.8.8 → 0.0.9.0
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3437db532ebccdc345287d49824cd56424a9bc11
|
4
|
+
data.tar.gz: 757d62f6476b7ddf9d363ea7d9f40a43a34f84f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a52d807193b0de7a24876a746f4ca29242e60f29cb2eb67a71d0da5b2f484b8c0282f285a9f4ff936f1a7466d72e213516919390d636d669d23e7dce57294aa
|
7
|
+
data.tar.gz: 2a2a4605e65b9b401962cc6073375b758ae9145c3e3b7afe8c9c63cc7883128494279a56d0c16ef8f3229a7ba63528c30b192ebe67e8e5e67f88834fdbbb69e6
|
@@ -1,6 +1,8 @@
|
|
1
1
|
module ZuoraConnect
|
2
2
|
class AppInstance < ActiveRecord::Base
|
3
3
|
after_initialize :init
|
4
|
+
before_create :generate_access_token
|
5
|
+
validates :token, :uniqueness => true
|
4
6
|
attr_accessor :options, :mode, :logins, :valid, :task_data, :last_refresh, :username, :password
|
5
7
|
|
6
8
|
def init
|
@@ -100,5 +102,12 @@ module ZuoraConnect
|
|
100
102
|
singleton_class.class_eval { attr_accessor "#{field}" }
|
101
103
|
send("#{field}=", val)
|
102
104
|
end
|
105
|
+
|
106
|
+
def generate_access_token
|
107
|
+
begin
|
108
|
+
self.token = SecureRandom.hex
|
109
|
+
end while self.class.exists?(token: token)
|
110
|
+
end
|
111
|
+
|
103
112
|
end
|
104
113
|
end
|
@@ -10,9 +10,14 @@ module ZuoraConnect
|
|
10
10
|
|
11
11
|
def authenticate_app_api_request
|
12
12
|
authenticate_or_request_with_http_basic do |username, password|
|
13
|
-
@appinstance = ZuoraConnect::AppInstance.
|
14
|
-
|
15
|
-
|
13
|
+
@appinstance = ZuoraConnect::AppInstance.where(:token => password).first
|
14
|
+
if !@appinstance.blank?
|
15
|
+
@appinstance.new_session(:session => {})
|
16
|
+
Thread.current[:appinstance] = @appinstance
|
17
|
+
return @appinstance.valid
|
18
|
+
else
|
19
|
+
return false
|
20
|
+
end
|
16
21
|
end
|
17
22
|
end
|
18
23
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zuora_connect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Connect Team
|
@@ -128,6 +128,7 @@ files:
|
|
128
128
|
- config/routes.rb
|
129
129
|
- db/migrate/20160718151733_create_connect_app_instances.rb
|
130
130
|
- db/migrate/20161024162319_add_tokens_to_app_instance.rb
|
131
|
+
- db/migrate/20161024220705_add_token_to_app_instance.rb
|
131
132
|
- lib/tasks/zuora_connect_tasks.rake
|
132
133
|
- lib/zuora_connect.rb
|
133
134
|
- lib/zuora_connect/configuration.rb
|