ramen-rails 0.5.1 → 0.6.0

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: 9de77426d862cf8695c418cc468c76e3760a89cd
4
- data.tar.gz: b09b033f511c2a342e1eac842a14068d2fb4fd98
3
+ metadata.gz: 739a8cfacae68879c56af820125300e74c57b518
4
+ data.tar.gz: 76475fc30d26b8dcd1470fbc54f1d37b1a1505b4
5
5
  SHA512:
6
- metadata.gz: acb1e662f59381d32a1bc9fb764c94b2de8e6bf138aaf63d150c0afcba4e6f271d8dd2211d894d1430ddca5a5e262f951713ea80227f4e0868a7cd91f9938cad
7
- data.tar.gz: 6937e82d0cf6a6bd1cd1a8472ec4f446d7e25a55a3d0a865b2914b54c5e7a563f1c33dc4059f14a9ad2c53607cb20670f02c895fd8e784793e94d8b82b160ae0
6
+ metadata.gz: 96fbb2673a786c57e93bdcb03f9e027b3c39dcd858a7e70dbe1bf5c9befd23bd488bed345bb024d223acc6adb4e5e07bafc8152a21f1aaf3fa41dc765d7c111d
7
+ data.tar.gz: 17533a7f642eb7e3b8a39666035a250b0c16de1e35bd7070c4f680a884fdbe075ac0acbbbdaa76ff749e4c0afefb8b13c7e577d0968f76d553c0325bcea00acc
data/CHANGELOG CHANGED
@@ -19,3 +19,6 @@ Add support for Companies
19
19
 
20
20
  Version 0.5.1
21
21
  Make importer support Companies. Add tests for importer.
22
+
23
+ Version 0.6.0
24
+ Support sending custom `trait` data into Ramen for Users & Companies.
@@ -200,6 +200,10 @@ module RamenRails
200
200
  if user.respond_to?(:created_at) && user.send(:created_at).present?
201
201
  obj[:user][:created_at] = user.send(:created_at).to_i
202
202
  end
203
+
204
+ if user.respond_to?(:traits) && user.send(:traits).present?
205
+ obj[:user][:traits] = user.send(:traits)
206
+ end
203
207
 
204
208
  obj[:user][:value] = ramen_user_value if ramen_user_value.present?
205
209
  obj[:user][:labels] = ramen_user_labels unless ramen_user_labels.nil?
@@ -212,7 +216,11 @@ module RamenRails
212
216
  [:url, :name, :id].each do |attr|
213
217
  obj[:company][attr] = company.send(attr)
214
218
  end
215
-
219
+
220
+ if company.respond_to?(:traits) && company.send(:traits).present?
221
+ obj[:company][:traits] = company.send(:traits)
222
+ end
223
+
216
224
  obj[:company][:labels] = ramen_company_labels unless ramen_company_labels.nil?
217
225
  end
218
226
 
@@ -1,3 +1,3 @@
1
1
  module RamenRails
2
- VERSION = "0.5.1"
2
+ VERSION = "0.6.0"
3
3
  end
@@ -99,6 +99,18 @@ describe 'After filter' do
99
99
 
100
100
  end
101
101
 
102
+ context "that responds to traits" do
103
+ before :each do
104
+ @dummy.current_user.traits = {bucket: 6, is_friend: true, original_name: "Netflix"}
105
+ end
106
+
107
+ it "should attach traits to company" do
108
+ filter = RamenRails::RamenAfterFilter.filter(@dummy)
109
+ expect(@dummy.response.body).to include('"is_friend":true')
110
+ end
111
+ end
112
+
113
+
102
114
  context "that responds to created_at" do
103
115
  before :each do
104
116
  @time = Time.new(2014, 11, 10)
@@ -170,8 +182,7 @@ describe 'After filter' do
170
182
  end
171
183
  end
172
184
 
173
- context "and a company" do
174
-
185
+ context "and a company" do
175
186
  context "that has no id" do
176
187
  before :each do
177
188
  RamenRails.config do |c|
@@ -194,7 +205,22 @@ describe 'After filter' do
194
205
  before :each do
195
206
  RamenRails.config do |c|
196
207
  c.current_company = Proc.new { Hashie::Mash.new(id: "1245", name: 'Scrubber', url: 'https://scrubber.social') }
197
- c.current_company_labels = Proc.new { ["ryan", "gold"] }
208
+ c.current_company_labels = Proc.new { ["ryan", "goldzz"] }
209
+ end
210
+ end
211
+
212
+ context "and traits" do
213
+ before :each do
214
+ RamenRails.config do |c|
215
+ c.current_company = Proc.new {
216
+ Hashie::Mash.new(id: "1245", name: 'Scrubber', url: 'https://scrubber.social', traits: {plan: 'startup'})
217
+ }
218
+ end
219
+ end
220
+
221
+ it "should attach traits to company" do
222
+ filter = RamenRails::RamenAfterFilter.filter(@dummy)
223
+ expect(@dummy.response.body).to include('"plan":"startup"')
198
224
  end
199
225
  end
200
226
 
@@ -205,7 +231,7 @@ describe 'After filter' do
205
231
  expect(@dummy.response.body).to include("company")
206
232
  expect(@dummy.response.body).to include("Scrubber")
207
233
  expect(@dummy.response.body).to include("1245")
208
- expect(@dummy.response.body).to include("gold")
234
+ expect(@dummy.response.body).to include("goldzz")
209
235
  end
210
236
  end
211
237
  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.5.1
4
+ version: 0.6.0
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-06-13 00:00:00.000000000 Z
11
+ date: 2015-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack