neuron-client 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/neuron-client/model/admin/pixel.rb +12 -0
- data/lib/neuron-client/model/common/ad.rb +2 -0
- data/lib/neuron-client/model/common/pixel.rb +18 -0
- data/lib/neuron-client/model/membase/pixel.rb +22 -0
- data/lib/neuron-client/model/models.rb +1 -0
- data/lib/neuron-client/version.rb +1 -1
- data/lib/neuron-client.rb +3 -0
- data/spec/lib/model/membase/pixel_spec.rb +34 -0
- metadata +24 -72
@@ -0,0 +1,22 @@
|
|
1
|
+
module Neuron
|
2
|
+
module Client
|
3
|
+
module Model
|
4
|
+
module Membase
|
5
|
+
class Pixel < Common::Pixel
|
6
|
+
|
7
|
+
class << self
|
8
|
+
def find(id)
|
9
|
+
self.connection.local_cache.fetch("Neuron::Client::Model::Pixel:#{id}") do
|
10
|
+
pixel = nil
|
11
|
+
membase_key = "Pixel:#{id}"
|
12
|
+
cached_json = self.connection.get(membase_key)
|
13
|
+
pixel = self.new(Yajl.load(cached_json)[superclass.resource_name]) if cached_json.present?
|
14
|
+
pixel
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/neuron-client.rb
CHANGED
@@ -14,6 +14,7 @@ require "neuron-client/model/common/ad_zone"
|
|
14
14
|
require "neuron-client/model/common/blocked_referer"
|
15
15
|
require "neuron-client/model/common/blocked_user_agent"
|
16
16
|
require "neuron-client/model/common/geo_target"
|
17
|
+
require "neuron-client/model/common/pixel"
|
17
18
|
require "neuron-client/model/common/report"
|
18
19
|
require "neuron-client/model/common/s3_file"
|
19
20
|
require "neuron-client/model/common/zone_calculations"
|
@@ -25,6 +26,7 @@ require "neuron-client/model/admin/ad_zone"
|
|
25
26
|
require "neuron-client/model/admin/blocked_referer"
|
26
27
|
require "neuron-client/model/admin/blocked_user_agent"
|
27
28
|
require "neuron-client/model/admin/geo_target"
|
29
|
+
require "neuron-client/model/admin/pixel"
|
28
30
|
require "neuron-client/model/admin/report"
|
29
31
|
require "neuron-client/model/admin/s3_file"
|
30
32
|
require "neuron-client/model/admin/zone"
|
@@ -34,6 +36,7 @@ require "neuron-client/model/membase/ad_zone"
|
|
34
36
|
require "neuron-client/model/membase/blocked_referer"
|
35
37
|
require "neuron-client/model/membase/blocked_user_agent"
|
36
38
|
require "neuron-client/model/membase/geo_target"
|
39
|
+
require "neuron-client/model/membase/pixel"
|
37
40
|
require "neuron-client/model/membase/report"
|
38
41
|
require "neuron-client/model/membase/s3_file"
|
39
42
|
require "neuron-client/model/membase/zone"
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Neuron
|
2
|
+
module Client
|
3
|
+
module Model
|
4
|
+
module Membase
|
5
|
+
describe Pixel do
|
6
|
+
describe "Pixel.find(id)" do
|
7
|
+
context "when the connection returns a value" do
|
8
|
+
it "should call the expected methods and return the expected value" do
|
9
|
+
c = stub(:connection)
|
10
|
+
Pixel.should_receive(:connection).exactly(2).times.and_return(c)
|
11
|
+
p = stub(:pixel)
|
12
|
+
c.stub_chain(:local_cache, :fetch).with('Neuron::Client::Model::Pixel:7').and_yield.and_return(p)
|
13
|
+
c.should_receive(:get).with('Pixel:7').and_return('{"pixel":{"attr":"value","attr2":"value2"}}')
|
14
|
+
Pixel.should_receive(:new).with({'attr' => 'value', 'attr2' => 'value2'}).and_return(p)
|
15
|
+
|
16
|
+
Pixel.find(7).should == p
|
17
|
+
end
|
18
|
+
end
|
19
|
+
context "when the connection returns nil" do
|
20
|
+
it "should call the expected methods and return nil" do
|
21
|
+
c = stub(:connection)
|
22
|
+
Pixel.should_receive(:connection).exactly(2).times.and_return(c)
|
23
|
+
c.stub_chain(:local_cache, :fetch).with('Neuron::Client::Model::Pixel:7').and_yield.and_return(nil)
|
24
|
+
c.should_receive(:get).with('Pixel:7').and_return(nil)
|
25
|
+
|
26
|
+
Pixel.find(7).should be_nil
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: neuron-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 5
|
10
|
+
version: 0.2.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- RMM Online
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-11-01 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -176,26 +176,10 @@ dependencies:
|
|
176
176
|
version: 0.4.2
|
177
177
|
type: :development
|
178
178
|
version_requirements: *id009
|
179
|
-
- !ruby/object:Gem::Dependency
|
180
|
-
name: rb-fsevent
|
181
|
-
prerelease: false
|
182
|
-
requirement: &id010 !ruby/object:Gem::Requirement
|
183
|
-
none: false
|
184
|
-
requirements:
|
185
|
-
- - ~>
|
186
|
-
- !ruby/object:Gem::Version
|
187
|
-
hash: 9
|
188
|
-
segments:
|
189
|
-
- 0
|
190
|
-
- 4
|
191
|
-
- 3
|
192
|
-
version: 0.4.3
|
193
|
-
type: :development
|
194
|
-
version_requirements: *id010
|
195
179
|
- !ruby/object:Gem::Dependency
|
196
180
|
name: guard
|
197
181
|
prerelease: false
|
198
|
-
requirement: &
|
182
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
199
183
|
none: false
|
200
184
|
requirements:
|
201
185
|
- - ~>
|
@@ -207,11 +191,11 @@ dependencies:
|
|
207
191
|
- 2
|
208
192
|
version: 0.6.2
|
209
193
|
type: :development
|
210
|
-
version_requirements: *
|
194
|
+
version_requirements: *id010
|
211
195
|
- !ruby/object:Gem::Dependency
|
212
196
|
name: guard-bundler
|
213
197
|
prerelease: false
|
214
|
-
requirement: &
|
198
|
+
requirement: &id011 !ruby/object:Gem::Requirement
|
215
199
|
none: false
|
216
200
|
requirements:
|
217
201
|
- - ~>
|
@@ -223,11 +207,11 @@ dependencies:
|
|
223
207
|
- 3
|
224
208
|
version: 0.1.3
|
225
209
|
type: :development
|
226
|
-
version_requirements: *
|
210
|
+
version_requirements: *id011
|
227
211
|
- !ruby/object:Gem::Dependency
|
228
212
|
name: guard-rspec
|
229
213
|
prerelease: false
|
230
|
-
requirement: &
|
214
|
+
requirement: &id012 !ruby/object:Gem::Requirement
|
231
215
|
none: false
|
232
216
|
requirements:
|
233
217
|
- - ~>
|
@@ -239,11 +223,11 @@ dependencies:
|
|
239
223
|
- 2
|
240
224
|
version: 0.4.2
|
241
225
|
type: :development
|
242
|
-
version_requirements: *
|
226
|
+
version_requirements: *id012
|
243
227
|
- !ruby/object:Gem::Dependency
|
244
228
|
name: fakeweb
|
245
229
|
prerelease: false
|
246
|
-
requirement: &
|
230
|
+
requirement: &id013 !ruby/object:Gem::Requirement
|
247
231
|
none: false
|
248
232
|
requirements:
|
249
233
|
- - ~>
|
@@ -255,11 +239,11 @@ dependencies:
|
|
255
239
|
- 0
|
256
240
|
version: 1.3.0
|
257
241
|
type: :development
|
258
|
-
version_requirements: *
|
242
|
+
version_requirements: *id013
|
259
243
|
- !ruby/object:Gem::Dependency
|
260
244
|
name: vcr
|
261
245
|
prerelease: false
|
262
|
-
requirement: &
|
246
|
+
requirement: &id014 !ruby/object:Gem::Requirement
|
263
247
|
none: false
|
264
248
|
requirements:
|
265
249
|
- - ~>
|
@@ -271,11 +255,11 @@ dependencies:
|
|
271
255
|
- 1
|
272
256
|
version: 1.11.1
|
273
257
|
type: :development
|
274
|
-
version_requirements: *
|
258
|
+
version_requirements: *id014
|
275
259
|
- !ruby/object:Gem::Dependency
|
276
260
|
name: timecop
|
277
261
|
prerelease: false
|
278
|
-
requirement: &
|
262
|
+
requirement: &id015 !ruby/object:Gem::Requirement
|
279
263
|
none: false
|
280
264
|
requirements:
|
281
265
|
- - ~>
|
@@ -287,11 +271,11 @@ dependencies:
|
|
287
271
|
- 5
|
288
272
|
version: 0.3.5
|
289
273
|
type: :development
|
290
|
-
version_requirements: *
|
274
|
+
version_requirements: *id015
|
291
275
|
- !ruby/object:Gem::Dependency
|
292
276
|
name: chronic
|
293
277
|
prerelease: false
|
294
|
-
requirement: &
|
278
|
+
requirement: &id016 !ruby/object:Gem::Requirement
|
295
279
|
none: false
|
296
280
|
requirements:
|
297
281
|
- - ~>
|
@@ -303,7 +287,7 @@ dependencies:
|
|
303
287
|
- 2
|
304
288
|
version: 0.6.2
|
305
289
|
type: :development
|
306
|
-
version_requirements: *
|
290
|
+
version_requirements: *id016
|
307
291
|
description: Neuron Admin Client Gem
|
308
292
|
email:
|
309
293
|
- devteam@rmmonline.com
|
@@ -331,6 +315,7 @@ files:
|
|
331
315
|
- lib/neuron-client/model/admin/blocked_referer.rb
|
332
316
|
- lib/neuron-client/model/admin/blocked_user_agent.rb
|
333
317
|
- lib/neuron-client/model/admin/geo_target.rb
|
318
|
+
- lib/neuron-client/model/admin/pixel.rb
|
334
319
|
- lib/neuron-client/model/admin/report.rb
|
335
320
|
- lib/neuron-client/model/admin/s3_file.rb
|
336
321
|
- lib/neuron-client/model/admin/zone.rb
|
@@ -342,6 +327,7 @@ files:
|
|
342
327
|
- lib/neuron-client/model/common/blocked_referer.rb
|
343
328
|
- lib/neuron-client/model/common/blocked_user_agent.rb
|
344
329
|
- lib/neuron-client/model/common/geo_target.rb
|
330
|
+
- lib/neuron-client/model/common/pixel.rb
|
345
331
|
- lib/neuron-client/model/common/report.rb
|
346
332
|
- lib/neuron-client/model/common/s3_file.rb
|
347
333
|
- lib/neuron-client/model/common/zone.rb
|
@@ -351,6 +337,7 @@ files:
|
|
351
337
|
- lib/neuron-client/model/membase/blocked_referer.rb
|
352
338
|
- lib/neuron-client/model/membase/blocked_user_agent.rb
|
353
339
|
- lib/neuron-client/model/membase/geo_target.rb
|
340
|
+
- lib/neuron-client/model/membase/pixel.rb
|
354
341
|
- lib/neuron-client/model/membase/report.rb
|
355
342
|
- lib/neuron-client/model/membase/s3_file.rb
|
356
343
|
- lib/neuron-client/model/membase/zone.rb
|
@@ -388,6 +375,7 @@ files:
|
|
388
375
|
- spec/lib/model/membase/blocked_referer_spec.rb
|
389
376
|
- spec/lib/model/membase/blocked_user_agent_spec.rb
|
390
377
|
- spec/lib/model/membase/geo_target_spec.rb
|
378
|
+
- spec/lib/model/membase/pixel_spec.rb
|
391
379
|
- spec/lib/model/membase/report_spec.rb
|
392
380
|
- spec/lib/model/membase/s3_spec.rb
|
393
381
|
- spec/lib/model/membase/zone_spec.rb
|
@@ -428,41 +416,5 @@ rubygems_version: 1.6.2
|
|
428
416
|
signing_key:
|
429
417
|
specification_version: 3
|
430
418
|
summary: Neuron Admin Client Gem
|
431
|
-
test_files:
|
432
|
-
|
433
|
-
- spec/lib/admin_connection_spec.rb
|
434
|
-
- spec/lib/api_spec.rb
|
435
|
-
- spec/lib/membase_connection_spec.rb
|
436
|
-
- spec/lib/model/admin/ad_spec.rb
|
437
|
-
- spec/lib/model/admin/ad_zone_spec.rb
|
438
|
-
- spec/lib/model/admin/base_spec.rb
|
439
|
-
- spec/lib/model/admin/blocked_referer_spec.rb
|
440
|
-
- spec/lib/model/admin/blocked_user_agent_spec.rb
|
441
|
-
- spec/lib/model/admin/geo_target_spec.rb
|
442
|
-
- spec/lib/model/admin/report_spec.rb
|
443
|
-
- spec/lib/model/admin/s3_spec.rb
|
444
|
-
- spec/lib/model/admin/zone_spec.rb
|
445
|
-
- spec/lib/model/base_spec.rb
|
446
|
-
- spec/lib/model/common/ad_calculations_spec.rb
|
447
|
-
- spec/lib/model/common/ad_spec.rb
|
448
|
-
- spec/lib/model/common/ad_zone_spec.rb
|
449
|
-
- spec/lib/model/common/base_spec.rb
|
450
|
-
- spec/lib/model/common/blocked_referer_spec.rb
|
451
|
-
- spec/lib/model/common/blocked_user_agent_spec.rb
|
452
|
-
- spec/lib/model/common/geo_target_spec.rb
|
453
|
-
- spec/lib/model/common/report_spec.rb
|
454
|
-
- spec/lib/model/common/s3_spec.rb
|
455
|
-
- spec/lib/model/common/zone_calculations_spec.rb
|
456
|
-
- spec/lib/model/common/zone_spec.rb
|
457
|
-
- spec/lib/model/membase/ad_spec.rb
|
458
|
-
- spec/lib/model/membase/ad_zone_spec.rb
|
459
|
-
- spec/lib/model/membase/base_spec.rb
|
460
|
-
- spec/lib/model/membase/blocked_referer_spec.rb
|
461
|
-
- spec/lib/model/membase/blocked_user_agent_spec.rb
|
462
|
-
- spec/lib/model/membase/geo_target_spec.rb
|
463
|
-
- spec/lib/model/membase/report_spec.rb
|
464
|
-
- spec/lib/model/membase/s3_spec.rb
|
465
|
-
- spec/lib/model/membase/zone_spec.rb
|
466
|
-
- spec/lib/old_spec.rb
|
467
|
-
- spec/lib/s3_file_spec.rb
|
468
|
-
- spec/spec_helper.rb
|
419
|
+
test_files: []
|
420
|
+
|