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.
@@ -0,0 +1,12 @@
1
+ module Neuron
2
+ module Client
3
+ module Model
4
+ module Admin
5
+ class Pixel < Common::Pixel
6
+ include Base
7
+
8
+ end
9
+ end
10
+ end
11
+ end
12
+ end
@@ -21,6 +21,8 @@ module Neuron
21
21
  :daily_cap, :day_partitions, :ideal_impressions_per_hour,
22
22
  # range
23
23
  :start_datetime, :end_datetime, :time_zone,
24
+ # related pixels
25
+ :pixel_ids,
24
26
  # timestamps
25
27
  :created_at, :updated_at
26
28
 
@@ -0,0 +1,18 @@
1
+ module Neuron
2
+ module Client
3
+ module Model
4
+ module Common
5
+ class Pixel
6
+ include Base
7
+
8
+ resource_name("pixel")
9
+ resources_name("pixels")
10
+
11
+ # time stamps
12
+ attr_accessor :created_at, :updated_at
13
+
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -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
@@ -6,6 +6,7 @@ module Neuron
6
6
  class BlockedReferer < Base; end
7
7
  class BlockedUserAgent < Base; end
8
8
  class GeoTarget < Base; end
9
+ class Pixel < Base; end
9
10
  class Report < Base; end
10
11
  class S3File < Base; end
11
12
  class Zone < Base; end
@@ -1,5 +1,5 @@
1
1
  module Neuron
2
2
  module Client
3
- VERSION = "0.2.4"
3
+ VERSION = "0.2.5"
4
4
  end
5
5
  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: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 4
10
- version: 0.2.4
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-10-03 00:00:00 -05:00
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: &id011 !ruby/object:Gem::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: *id011
194
+ version_requirements: *id010
211
195
  - !ruby/object:Gem::Dependency
212
196
  name: guard-bundler
213
197
  prerelease: false
214
- requirement: &id012 !ruby/object:Gem::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: *id012
210
+ version_requirements: *id011
227
211
  - !ruby/object:Gem::Dependency
228
212
  name: guard-rspec
229
213
  prerelease: false
230
- requirement: &id013 !ruby/object:Gem::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: *id013
226
+ version_requirements: *id012
243
227
  - !ruby/object:Gem::Dependency
244
228
  name: fakeweb
245
229
  prerelease: false
246
- requirement: &id014 !ruby/object:Gem::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: *id014
242
+ version_requirements: *id013
259
243
  - !ruby/object:Gem::Dependency
260
244
  name: vcr
261
245
  prerelease: false
262
- requirement: &id015 !ruby/object:Gem::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: *id015
258
+ version_requirements: *id014
275
259
  - !ruby/object:Gem::Dependency
276
260
  name: timecop
277
261
  prerelease: false
278
- requirement: &id016 !ruby/object:Gem::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: *id016
274
+ version_requirements: *id015
291
275
  - !ruby/object:Gem::Dependency
292
276
  name: chronic
293
277
  prerelease: false
294
- requirement: &id017 !ruby/object:Gem::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: *id017
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
- - spec/fixtures/vcr_cassettes/s3_file.yml
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
+