zuora_connect 1.2.1 → 1.2.2
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 +4 -4
- data/app/models/zuora_connect/app_instance.rb +17 -1
- data/lib/zuora_connect/configuration.rb +6 -1
- data/lib/zuora_connect/engine.rb +1 -0
- data/lib/zuora_connect/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bbc95e208317a9604d92be0c8cfefeb04ae4020b
|
4
|
+
data.tar.gz: 40d63a353dcf3d046ded826f3bf7e8d2fdd2afc1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a0bdbaa0ed3b6d9244a9162f50289ed415861f9784274eba11368147885c9b4cd99ecd35d2fc3914803d3a03eab82d2e5fcf13424bc24ccef337b83995a0ec53
|
7
|
+
data.tar.gz: 414db04df2bce3337c2b1d20e02a935cdd28ac8cecb744fd65091980f08a426acc0fd1995641a16b3cb42ed0ef60d1044f4450b315963b592d015d0706b744df
|
@@ -2,11 +2,16 @@ module ZuoraConnect
|
|
2
2
|
class AppInstance < ActiveRecord::Base
|
3
3
|
after_initialize :init
|
4
4
|
before_create :generate_access_token
|
5
|
-
attr_accessor :options, :mode, :logins, :valid, :task_data, :last_refresh, :username, :password
|
5
|
+
attr_accessor :options, :mode, :logins, :valid, :task_data, :last_refresh, :username, :password, :s3_client
|
6
6
|
|
7
7
|
def init
|
8
8
|
@options = Hash.new
|
9
9
|
@logins = Hash.new
|
10
|
+
if ZuoraConnect.configuration.mode == "Development"
|
11
|
+
@s3_client = Aws::S3::Resource.new(region: ZuoraConnect.configuration.aws_region,access_key_id: ZuoraConnect.configuration.dev_mode_access_key_id,secret_access_key: ZuoraConnect.configuration.dev_mode_secret_access_key)
|
12
|
+
else
|
13
|
+
@s3_client = Aws::S3::Resource.new(region: ZuoraConnect.configuration.aws_region)
|
14
|
+
end
|
10
15
|
@valid = false
|
11
16
|
self.attr_builder("timezone", ZuoraConnect.configuration.default_time_zone)
|
12
17
|
self.attr_builder("locale", ZuoraConnect.configuration.default_locale)
|
@@ -118,6 +123,17 @@ module ZuoraConnect
|
|
118
123
|
|
119
124
|
end
|
120
125
|
|
126
|
+
def upload_to_s3(local_file,s3_path = nil)
|
127
|
+
s3_path = local_file.split("/").last if s3_path.nil?
|
128
|
+
obj = @s3_client.bucket(ZuoraConnect.configuration.s3_bucket_name).object("#{ZuoraConnect.configuration.s3_folder_name}/#{self.id.to_s}/#{s3_path}}")
|
129
|
+
obj.upload_file(local_file)
|
130
|
+
end
|
131
|
+
|
132
|
+
def get_s3_file_url(key)
|
133
|
+
signer = Aws::S3::Presigner.new(client: @s3_client)
|
134
|
+
url = signer.presigned_url(:get_object, bucket: ZuoraConnect.configuration.s3_bucket_name, key: "#{ZuoraConnect.configuration.s3_folder_name}/#{key}")
|
135
|
+
end
|
136
|
+
|
121
137
|
def self.decrypt_response(resp)
|
122
138
|
OpenSSL::PKey::RSA.new(ZuoraConnect.configuration.private_key).private_decrypt(resp)
|
123
139
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module ZuoraConnect
|
2
2
|
class Configuration
|
3
|
-
attr_accessor :default_locale,:dev_mode_appinstance ,:dev_mode_admin, :dev_mode_user, :dev_mode_pass, :default_time_zone,:delayed_job,:url, :private_key, :dev_mode_logins,:dev_mode_mode, :dev_mode_options, :mode, :timeout
|
3
|
+
attr_accessor :default_locale,:dev_mode_appinstance ,:dev_mode_admin, :dev_mode_user, :dev_mode_pass, :default_time_zone,:delayed_job,:url, :private_key, :dev_mode_logins,:dev_mode_mode, :dev_mode_options, :mode, :timeout,:dev_mode_secret_access_key,:dev_mode_access_key_id,:aws_region, :s3_bucket_name, :s3_folder_name
|
4
4
|
|
5
5
|
def initialize
|
6
6
|
@timeout = 5.minutes
|
@@ -19,6 +19,11 @@ module ZuoraConnect
|
|
19
19
|
@dev_mode_user = "test"
|
20
20
|
@dev_mode_pass = "test"
|
21
21
|
@dev_mode_admin = false
|
22
|
+
@dev_mode_secret_access_key = nil
|
23
|
+
@dev_mode_access_key_id = nil
|
24
|
+
@aws_region = "us-west-2"
|
25
|
+
@s3_bucket_name = "rbm-apps"
|
26
|
+
@s3_folder_name = Rails.application.class.parent_name
|
22
27
|
end
|
23
28
|
end
|
24
29
|
end
|
data/lib/zuora_connect/engine.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zuora_connect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Connect Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord-session_store
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '3.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: aws-sdk-rails
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: railties
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|