zuora_connect 0.0.7.0 → 0.0.7.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: 90f6762e1cf7591034ce1c3d210140fd5f742011
4
- data.tar.gz: 9988fc2573e5f4009565f87cd273c8a79478bed1
3
+ metadata.gz: 59324dd783126e0503ee4920b9f4cded6158091e
4
+ data.tar.gz: 454b9bdea7b1e04ee58ab9b5260c1e58916084eb
5
5
  SHA512:
6
- metadata.gz: d07bf4eea5ebf82be55675760d3b473843843d28be5be719cf98136325634a7afc93ad855524c8bbe48c4226a2e391b8d56c8a31d4b237ad78350bc4397f2d95
7
- data.tar.gz: bbc2ff58ece14f5f1e410c4c37d86b76a1e2f9d7b9500d9c3a7587d2cb555ca82b74e88ec447b6cd527543a93f7569449342f07d68733adeb1c2d46a5633ea63
6
+ metadata.gz: 20978a678b3ac41003e8f0d2146de84edb5777ef491e5f18da72bbab565ac894b7a9c740a15de76ed11b7ab41df49f9cbbd695990ae4d3ba6b127bedbd1a7342
7
+ data.tar.gz: 359e547cfdbd08461a63dc0af2e1a4b765fe81bd06972283708d325743c06c043fcedefdae330a7b4182087e5001fdd170f6935ef1031978dc76fa86846ccd86
@@ -10,4 +10,6 @@
10
10
  // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
11
  // about supported directives.
12
12
  //
13
+ //= require jquery
14
+ //= require jquery_ujs
13
15
  //= require_tree .
@@ -1,13 +1,8 @@
1
1
  module ZuoraConnect
2
2
  class ApplicationController < ActionController::Base
3
3
  protect_from_forgery with: :exception
4
- before_filter :authenticate_request, :except => [:health]
4
+ before_filter :authenticate_connect_app_request
5
+ after_filter :persist_connect_app_session
5
6
 
6
- def health
7
- render json: {
8
- message: "Alive",
9
- status: 200
10
- }, status: 200
11
- end
12
7
  end
13
8
  end
@@ -0,0 +1,28 @@
1
+ module ZuoraConnect
2
+ class StaticController < ApplicationController
3
+ before_filter :authenticate_connect_app_request, :except => [:health, :session_error, :invalid_app_instance_error]
4
+ after_filter :persist_connect_app_session, :except => [:health, :session_error, :invalid_app_instance_error]
5
+ def session_error
6
+ respond_to do |format|
7
+ format.html
8
+ format.json { render json: { message: "Session Error", status: 500 }, status: 500 }
9
+ format.js {}
10
+ end
11
+ end
12
+
13
+ def invalid_app_instance_error
14
+ respond_to do |format|
15
+ format.html
16
+ format.json {render json: { message: "Invalid App Instance", status: 500 }, status: 500 }
17
+ format.js {}
18
+ end
19
+ end
20
+
21
+ def health
22
+ render json: {
23
+ message: "Alive",
24
+ status: 200
25
+ }, status: 200
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,65 @@
1
+ <html><head>
2
+ <title>We're sorry, but something went wrong (500)</title>
3
+ <meta name="viewport" content="width=device-width,initial-scale=1">
4
+ <style>
5
+ body {
6
+ background-color: #EFEFEF;
7
+ color: #2E2F30;
8
+ text-align: center;
9
+ font-family: arial, sans-serif;
10
+ margin: 0;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 95%;
15
+ max-width: 33em;
16
+ margin: 4em auto 0;
17
+ }
18
+
19
+ div.dialog > div {
20
+ border: 1px solid #CCC;
21
+ border-right-color: #999;
22
+ border-left-color: #999;
23
+ border-bottom-color: #BBB;
24
+ border-top: #B00100 solid 4px;
25
+ border-top-left-radius: 9px;
26
+ border-top-right-radius: 9px;
27
+ background-color: white;
28
+ padding: 7px 12% 0;
29
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
30
+ }
31
+
32
+ h1 {
33
+ font-size: 100%;
34
+ color: #730E15;
35
+ line-height: 1.5em;
36
+ }
37
+
38
+ div.dialog > p {
39
+ margin: 0 0 1em;
40
+ padding: 1em;
41
+ background-color: #F7F7F7;
42
+ border: 1px solid #CCC;
43
+ border-right-color: #999;
44
+ border-left-color: #999;
45
+ border-bottom-color: #999;
46
+ border-bottom-left-radius: 4px;
47
+ border-bottom-right-radius: 4px;
48
+ border-top-color: #DADADA;
49
+ color: #666;
50
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
51
+ }
52
+ </style>
53
+ </head>
54
+
55
+ <body>
56
+ <!-- This file lives in public/500.html -->
57
+ <div class="dialog">
58
+ <div>
59
+ <h1>We're sorry, but this request could not be verified.</h1>
60
+ </div>
61
+ <p>Please try relaunching this application at connect.zuora.com</p>
62
+ </div>
63
+
64
+
65
+ </body></html>
@@ -0,0 +1 @@
1
+ document.write('<%= escape_javascript render(:file=>"zuora_connect/static/invalid_app_instance_error", :formats => [:html]) %>');
@@ -0,0 +1,63 @@
1
+ <html><head>
2
+ <title>We're sorry, but something went wrong (500)</title>
3
+ <meta name="viewport" content="width=device-width,initial-scale=1">
4
+ <style>
5
+ body {
6
+ background-color: #EFEFEF;
7
+ color: #2E2F30;
8
+ text-align: center;
9
+ font-family: arial, sans-serif;
10
+ margin: 0;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 95%;
15
+ max-width: 33em;
16
+ margin: 4em auto 0;
17
+ }
18
+
19
+ div.dialog > div {
20
+ border: 1px solid #CCC;
21
+ border-right-color: #999;
22
+ border-left-color: #999;
23
+ border-bottom-color: #BBB;
24
+ border-top: #B00100 solid 4px;
25
+ border-top-left-radius: 9px;
26
+ border-top-right-radius: 9px;
27
+ background-color: white;
28
+ padding: 7px 12% 0;
29
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
30
+ }
31
+
32
+ h1 {
33
+ font-size: 100%;
34
+ color: #730E15;
35
+ line-height: 1.5em;
36
+ }
37
+
38
+ div.dialog > p {
39
+ margin: 0 0 1em;
40
+ padding: 1em;
41
+ background-color: #F7F7F7;
42
+ border: 1px solid #CCC;
43
+ border-right-color: #999;
44
+ border-left-color: #999;
45
+ border-bottom-color: #999;
46
+ border-bottom-left-radius: 4px;
47
+ border-bottom-right-radius: 4px;
48
+ border-top-color: #DADADA;
49
+ color: #666;
50
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
51
+ }
52
+ </style>
53
+ </head>
54
+
55
+ <body>
56
+ <!-- This file lives in public/500.html -->
57
+ <div class="dialog">
58
+ <div>
59
+ <h1>Session is invalid</h1>
60
+ </div>
61
+ <p>Please try relaunching the application from connect.zuora.com</p>
62
+ </div>
63
+ </body></html>
@@ -0,0 +1 @@
1
+ document.write('<%= escape_javascript render(:file=>"zuora_connect/static/session_error", :formats => [:html]) %>');
data/config/routes.rb CHANGED
@@ -1,3 +1,5 @@
1
1
  ZuoraConnect::Engine.routes.draw do
2
- get '/health' => 'application#health'
2
+ get '/health' => 'static#health'
3
+ get '/invalid_session' => 'static#session_error', :as => :invalid_session
4
+ get '/invalid_instance' => "static#invalid_app_instance_error", :as => :invalid_instance
3
5
  end
@@ -1,9 +1,13 @@
1
1
  module ZuoraConnect
2
2
  class Configuration
3
- attr_accessor :url, :private_key, :dev_mode_logins,:dev_mode_mode, :dev_mode_options, :mode, :timeout
3
+ attr_accessor :default_locale, :default_time_zone, :invalid_app_instance_error_path, :session_error_path,:url, :private_key, :dev_mode_logins,:dev_mode_mode, :dev_mode_options, :mode, :timeout
4
4
 
5
5
  def initialize
6
6
  @timeout = 5.minutes
7
+ @default_locale = :en
8
+ @default_time_zone = Time.zone
9
+ @session_error_path = '/connect/invalid_session'
10
+ @invalid_app_instance_error_path = '/connect/invalid_instance'
7
11
  @url = "http://localhost:3000"
8
12
  @mode = "Production"
9
13
  @dev_mode_logins = { "target_login" => {"tenant_type" => "Zuora", "username" => "user", "password" => "pass", "url" => "url"} }
@@ -17,13 +17,13 @@ module ZuoraConnect
17
17
  @appinstance = ZuoraConnect::AppInstance.find(instance_id)
18
18
  begin
19
19
  @appinstance.new_session(session["#{instance_id}::user"], session["#{instance_id}::key"], session)
20
- I18n.locale = @appinstance.task_data["user_settings"] && @appinstance.task_data["user_settings"]["local"] ? @appinstance.task_data["user_settings"]["local"] : :en
21
- Time.zone = @appinstance.task_data["user_settings"] && @appinstance.task_data["user_settings"]["timezone"] ? @appinstance.task_data["user_settings"]["timezone"] : Time.zone
20
+ I18n.locale = session["#{instance_id}::user::timezone"] ? session["#{instance_id}::user"] : ZuoraConnect.configuration.default_locale
21
+ Time.zone = session["#{instance_id}::user::locale"] ? session["#{instance_id}::user"] : ZuoraConnect.configuration.default_time_zone
22
22
  rescue
23
- redirect_to "/500.html"
23
+ redirect_to ZuoraConnect.configuration.session_error_path
24
24
  end
25
25
  else
26
- redirect_to "/500.html"
26
+ redirect_to ZuoraConnect.configuration.invalid_app_instance_error_path
27
27
  end
28
28
  else
29
29
  dev_mode
@@ -67,6 +67,8 @@ module ZuoraConnect
67
67
  params[k] = v
68
68
  end
69
69
  end
70
+ session["#{values["appInstance"]}::user::timezone"] = values["timezone"]
71
+ session["#{values["appInstance"]}::user::locale"] = values["local"]
70
72
  session["#{values["appInstance"]}::user"] = values["user"]
71
73
  session["#{values["appInstance"]}::key"] = values["key"]
72
74
  session["#{values["appInstance"]}::valid"] = false
@@ -2,6 +2,7 @@ require 'rails/all'
2
2
  require 'zuora_connect'
3
3
  require 'apartment'
4
4
  require 'httparty'
5
+ require 'jquery-rails'
5
6
 
6
7
  module ZuoraConnect
7
8
  class Engine < ::Rails::Engine
@@ -1,3 +1,3 @@
1
1
  module ZuoraConnect
2
- VERSION = "0.0.7.0"
2
+ VERSION = "0.0.7.1"
3
3
  end
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: 0.0.7.0
4
+ version: 0.0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Connect Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-12 00:00:00.000000000 Z
11
+ date: 2016-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: apartment
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '3.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: jquery-rails
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: railties
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -109,18 +123,23 @@ extra_rdoc_files: []
109
123
  files:
110
124
  - MIT-LICENSE
111
125
  - Rakefile
112
- - app/assets/javascripts/connect_sdk/api/v1/app_instance.js
113
- - app/assets/javascripts/connect_sdk/application.js
114
- - app/assets/stylesheets/connect_sdk/api/v1/app_instance.css
115
- - app/assets/stylesheets/connect_sdk/application.css
126
+ - app/assets/javascripts/zuora_connect/api/v1/app_instance.js
127
+ - app/assets/javascripts/zuora_connect/application.js
128
+ - app/assets/stylesheets/zuora_connect/api/v1/app_instance.css
129
+ - app/assets/stylesheets/zuora_connect/application.css
116
130
  - app/controllers/zuora_connect/admin/tenant_controller.rb
117
131
  - app/controllers/zuora_connect/api/v1/app_instance_controller.rb
118
132
  - app/controllers/zuora_connect/application_controller.rb
133
+ - app/controllers/zuora_connect/static_controller.rb
119
134
  - app/helpers/zuora_connect/api/v1/app_instance_helper.rb
120
135
  - app/helpers/zuora_connect/application_helper.rb
121
136
  - app/models/zuora_connect/app_instance.rb
122
137
  - app/models/zuora_connect/login.rb
123
138
  - app/views/layouts/zuora_connect/application.html.erb
139
+ - app/views/zuora_connect/static/invalid_app_instance_error.html.erb
140
+ - app/views/zuora_connect/static/invalid_app_instance_error.js.erb
141
+ - app/views/zuora_connect/static/session_error.html.erb
142
+ - app/views/zuora_connect/static/session_error.js.erb
124
143
  - config/initializers/apartment.rb
125
144
  - config/routes.rb
126
145
  - db/migrate/20160718151733_create_connect_app_instances.rb