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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2231db474859bb6ac9a717111a5bb44ba6ef4fee
4
- data.tar.gz: d9b7fcdefbe4adb5abccdbd8a87e99d756af8da9
3
+ metadata.gz: 8cb736f36bad50e4c22b9379354fe0a1b3c9b012
4
+ data.tar.gz: df380aa7ae3534a9cc8d7cc31f6b0358909dc264
5
5
  SHA512:
6
- metadata.gz: 487301f75169b1d3ed242194f8efd064ce1f0ffbd3d619f9b2d2634a06bb542b4f499637377d782e646bf7ad0ab6850934725af8febc1266e2851a84eca79723
7
- data.tar.gz: 0305862b25190f572c64d7d1de9d1217279da814bd2e8d202fff1c88bc364eb96492010b51d0039dd14987f0a5d71934a8b5c71ca8b7d85064fa0e04a4c41ae1
6
+ metadata.gz: 98def56c695d1dbac82f9855541fa8a8a3bfe4914bf68e1cbba883f3ce634223d6b68aefd488be79bfc4abce3c505e66e50c70d05d5dead10d130427deaa39a9
7
+ data.tar.gz: a16d8186bb9cea6f3a6fd490fd9f7aaaa1bdb3bbf99f4dc853b34b35ede18ba7f3dc400513a669e14918c06bb37c706e9e28e020800db27742e1c0fb84c6c431
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ramen-rails (0.0.5)
4
+ ramen-rails (0.0.6)
5
5
  activesupport (~> 4.0)
6
6
 
7
7
  GEM
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 given them tools to better understand
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.
@@ -4,6 +4,8 @@ module RamenRails
4
4
 
5
5
  class << self
6
6
 
7
+ attr_accessor :manual_opt_in, :return_url, :return_label
8
+
7
9
  def ensure_not_lambda!(v)
8
10
  if v.lambda?
9
11
  raise NoLambdasPlease.new <<-ERR
@@ -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
 
@@ -1,3 +1,3 @@
1
1
  module RamenRails
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -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.6
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-18 00:00:00.000000000 Z
11
+ date: 2015-04-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack