ramen-rails 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/lib/ramen-rails/config.rb +2 -0
- data/lib/ramen-rails/ramen_after_filter.rb +22 -1
- data/lib/ramen-rails/version.rb +1 -1
- data/spec/lib/ramen_after_filter_spec.rb +5 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8cb736f36bad50e4c22b9379354fe0a1b3c9b012
|
4
|
+
data.tar.gz: df380aa7ae3534a9cc8d7cc31f6b0358909dc264
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98def56c695d1dbac82f9855541fa8a8a3bfe4914bf68e1cbba883f3ce634223d6b68aefd488be79bfc4abce3c505e66e50c70d05d5dead10d130427deaa39a9
|
7
|
+
data.tar.gz: a16d8186bb9cea6f3a6fd490fd9f7aaaa1bdb3bbf99f4dc853b34b35ede18ba7f3dc400513a669e14918c06bb37c706e9e28e020800db27742e1c0fb84c6c431
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
[![Build Status](https://travis-ci.org/ramen-dev/ramen-rails.svg)](https://travis-ci.org/ramen-dev/ramen-rails)
|
3
3
|
|
4
4
|
This is a Rails helper for [Ramen](https://ramen.is). Ramen is a product that helps
|
5
|
-
B2B SaaS product managers build better products by
|
5
|
+
B2B SaaS product managers build better products by giving them tools to better understand
|
6
6
|
what their customers need, and how satisfied their customers are with the results.
|
7
7
|
|
8
8
|
This gem will automatically inject the `ramen.js` script tag into pages.
|
data/lib/ramen-rails/config.rb
CHANGED
@@ -49,6 +49,24 @@ module RamenRails
|
|
49
49
|
!!(response.body[CLOSING_BODY_TAG])
|
50
50
|
end
|
51
51
|
|
52
|
+
def return_url
|
53
|
+
return controller.instance_eval(&RamenRails.config.return_url) if RamenRails.config.return_url
|
54
|
+
ourl = Proc.new { request.original_url }
|
55
|
+
return controller.instance_eval(&ourl)
|
56
|
+
end
|
57
|
+
|
58
|
+
def return_label
|
59
|
+
return false unless RamenRails.config.return_label
|
60
|
+
|
61
|
+
controller.instance_eval(&RamenRails.config.return_label)
|
62
|
+
end
|
63
|
+
|
64
|
+
def manual_opt_in
|
65
|
+
return false unless RamenRails.config.manual_opt_in
|
66
|
+
|
67
|
+
!!controller.instance_eval(&RamenRails.config.manual_opt_in)
|
68
|
+
end
|
69
|
+
|
52
70
|
def ramen_script_tag_called_manually?
|
53
71
|
controller.instance_variable_get(SCRIPT_TAG_HELPER_CALLED_INSTANCE_VARIABLE)
|
54
72
|
end
|
@@ -113,7 +131,7 @@ module RamenRails
|
|
113
131
|
return nil unless ramen_user_object
|
114
132
|
|
115
133
|
begin
|
116
|
-
company = instance_eval(&RamenRails.config.current_company) if RamenRails.config.current_company.present?
|
134
|
+
company = controller.instance_eval(&RamenRails.config.current_company) if RamenRails.config.current_company.present?
|
117
135
|
rescue NameError => e
|
118
136
|
Rails.logger.debug "Swallowing NameError. We're probably in an Engine or some other context like Devise."
|
119
137
|
Rails.logger.debug e
|
@@ -138,6 +156,9 @@ module RamenRails
|
|
138
156
|
obj[:organization_id] = ramen_org_id
|
139
157
|
obj[:user] = {}
|
140
158
|
obj[:timestamp] = Time.now.to_i
|
159
|
+
obj[:manual_opt_in] = manual_opt_in
|
160
|
+
obj[:return_url] = return_url
|
161
|
+
obj[:return_label] = return_label
|
141
162
|
|
142
163
|
user = ramen_user_object
|
143
164
|
|
data/lib/ramen-rails/version.rb
CHANGED
@@ -4,6 +4,10 @@ describe 'After filter' do
|
|
4
4
|
|
5
5
|
before :each do
|
6
6
|
@dummy = Hashie::Mash.new({
|
7
|
+
request: {
|
8
|
+
original_url: "http://hiryan.com",
|
9
|
+
},
|
10
|
+
|
7
11
|
response: {
|
8
12
|
content_type: 'text/html',
|
9
13
|
body: "<html><body>hi</body>"
|
@@ -48,6 +52,7 @@ describe 'After filter' do
|
|
48
52
|
expect(@dummy.response.body).to include(ts_auth_hash)
|
49
53
|
expect(@dummy.response.body).to include("script")
|
50
54
|
expect(@dummy.response.body).to include("Angilly")
|
55
|
+
expect(@dummy.response.body).to include("hiryan.com")
|
51
56
|
expect(@dummy.response.body).to_not include("company")
|
52
57
|
end
|
53
58
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ramen-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Angilly
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03
|
11
|
+
date: 2015-04-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|