neuron-client 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -19,11 +19,6 @@ module Neuron
19
19
  :start_datetime, :end_datetime, :time_zone,
20
20
  # timestamps
21
21
  :created_at, :updated_at
22
-
23
- def valid?
24
- validate
25
- @errors.empty?
26
- end
27
22
 
28
23
  def self.stringify_day_partitions(days)
29
24
  result = ""
@@ -32,23 +27,9 @@ module Neuron
32
27
  end
33
28
  result
34
29
  end
35
-
36
- def validate
37
- @errors = []
38
- @errors << [:approved, "is not 'Yes' or 'No'"] if ["Yes", "No"].include?(@approved)
39
- @errors << [:response_type, "is not 'Redirect' or 'Video'"] if ["Redirect", "Video"].include?(@response_type)
40
- @errors << [:start_datetime, "is required"] if @start_datetime.blank?
41
- @errors << [:end_datetime, "is required"] if @end_datetime.blank?
42
- @errors << [:time_zone, "is required"] if @time_zone.blank?
43
-
44
- if @response_type == "Video"
45
- @errors << [:video_api_url, "is required"] if @video_api_url.blank?
46
- @errors << [:video_setup_xml, "is required"] if @video_setup_xml.blank?
47
- elsif @response_type == "Redirect"
48
- @errors << [:redirect_url, "is required"] if @redirect_url.blank?
49
- end
50
30
 
51
- @errors << [:day_partitions, "Must be exactly 168 TF characters"] if !@day_partitions.blank? && @day_partitions.length != 168 && !(@day_partitions.match(/[TF]+/).try(:to_a).try(:first) == @day_partitions)
31
+ def recent(statistic, parameters)
32
+ self.class.connection.get("ads/#{id}/recent/#{statistic}", parameters)
52
33
  end
53
34
 
54
35
  def unlink(ad_id)
@@ -0,0 +1,12 @@
1
+ module Neuron
2
+ module Client
3
+ class BlockedReferer
4
+ include Connected
5
+ resource_name("blocked_referer")
6
+ resources_name("blocked_referers")
7
+
8
+ attr_accessor :referer, :reversed_referer, :created_at, :updated_at
9
+
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ module Neuron
2
+ module Client
3
+ class BlockedUserAgent
4
+ include Connected
5
+ resource_name("blocked_user_agent")
6
+ resources_name("blocked_user_agents")
7
+
8
+ attr_accessor :user_agent, :description, :created_at, :updated_at
9
+
10
+ end
11
+ end
12
+ end
@@ -12,7 +12,7 @@ module Neuron
12
12
  def query_string(attrs={})
13
13
  q = []
14
14
  {:api_key => @key}.merge(attrs).each do |key, value|
15
- q << "#{key}=#{value.nil? ? '' : CGI::escape(value)}"
15
+ q << "#{key}=#{value.nil? ? '' : CGI::escape(value.to_s)}"
16
16
  end
17
17
  q.join("&")
18
18
  end
@@ -1,5 +1,5 @@
1
1
  module Neuron
2
2
  module Client
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
@@ -2,7 +2,7 @@
2
2
  - !ruby/struct:VCR::HTTPInteraction
3
3
  request: !ruby/struct:VCR::Request
4
4
  method: :post
5
- uri: http://127.0.0.1:3000/s3_files.json?api_key=
5
+ uri: http://127.0.0.1:3000/s3_files.json?api_key=secret
6
6
  body: !!null
7
7
  headers:
8
8
  accept:
@@ -19,7 +19,7 @@
19
19
  message: Created
20
20
  headers:
21
21
  location:
22
- - http://127.0.0.1:3000/s3_files/14
22
+ - http://127.0.0.1:3000/s3_files/1
23
23
  content-type:
24
24
  - application/json; charset=utf-8
25
25
  cache-control:
@@ -27,22 +27,22 @@
27
27
  x-ua-compatible:
28
28
  - IE=Edge
29
29
  x-runtime:
30
- - '0.067139'
30
+ - '2.156203'
31
31
  server:
32
32
  - WEBrick/1.3.1 (Ruby/1.9.2/2011-07-09)
33
33
  date:
34
- - Wed, 20 Jul 2011 22:09:23 GMT
34
+ - Tue, 26 Jul 2011 21:15:03 GMT
35
35
  content-length:
36
- - '157'
36
+ - '156'
37
37
  set-cookie:
38
- - _neuron-admin_session=BAh7BkkiD3Nlc3Npb25faWQGOgZFRiIlOWNjYmY1YTMxZjE1ZTg2YmI4OWIxZmY1ZmJkOTNmMzM%3D--d8721ac8475f99f21ce1726337ce3dc6570ee361;
38
+ - _neuron-admin_session=BAh7BkkiD3Nlc3Npb25faWQGOgZFRiIlNTkyMGNkZGRkZGEzMmI3ODFiMDhlZjI3ZjZjN2Y5ZTY%3D--abc9759030ac57f081014793dd0a18200acd40ce;
39
39
  path=/; HttpOnly
40
- body: ! '{"s3_file":{"bucket":"test","created_at":"2011-07-20T22:09:23Z","filename":"filename","id":14,"purpose":"RAW_EVENT_LOG","updated_at":"2011-07-20T22:09:23Z"}}'
40
+ body: ! '{"s3_file":{"bucket":"test","created_at":"2011-07-26T21:15:03Z","filename":"filename","id":1,"purpose":"RAW_EVENT_LOG","updated_at":"2011-07-26T21:15:03Z"}}'
41
41
  http_version: '1.1'
42
42
  - !ruby/struct:VCR::HTTPInteraction
43
43
  request: !ruby/struct:VCR::Request
44
44
  method: :get
45
- uri: http://127.0.0.1:3000/s3_files.json?api_key=
45
+ uri: http://127.0.0.1:3000/s3_files.json?api_key=secret
46
46
  body: !!null
47
47
  headers:
48
48
  accept:
@@ -59,25 +59,25 @@
59
59
  content-type:
60
60
  - application/json; charset=utf-8
61
61
  etag:
62
- - ! '"fa7070e53112e61619a0f53d917d99e7"'
62
+ - ! '"f28f9f731f02abb52de52eeb140f3904"'
63
63
  cache-control:
64
64
  - max-age=0, private, must-revalidate
65
65
  x-ua-compatible:
66
66
  - IE=Edge
67
67
  x-runtime:
68
- - '0.104567'
68
+ - '0.058083'
69
69
  server:
70
70
  - WEBrick/1.3.1 (Ruby/1.9.2/2011-07-09)
71
71
  date:
72
- - Wed, 20 Jul 2011 22:09:23 GMT
72
+ - Tue, 26 Jul 2011 21:15:03 GMT
73
73
  content-length:
74
- - '725'
75
- body: ! '[{"s3_file":{"bucket":"legal","created_at":"2011-07-20T20:53:18Z","filename":"legal","id":11,"purpose":"RAW_EVENT_LOG","updated_at":"2011-07-20T20:53:18Z"}},{"s3_file":{"bucket":"test","created_at":"2011-07-20T22:01:01Z","filename":"file5kqqlaqs12p84sr5b4nqfcc66oiddl9ob6k8wwi0izn1vl3aye","id":12,"purpose":"RAW_EVENT_LOG","updated_at":"2011-07-20T22:01:01Z"}},{"s3_file":{"bucket":"test","created_at":"2011-07-20T22:07:57Z","filename":"file47s8gkz0i4jt8efk47bz22ceggn2yfdcue1droev1imjyoppkv_2","id":13,"purpose":"RAW_EVENT_LOG","updated_at":"2011-07-20T22:07:57Z"}},{"s3_file":{"bucket":"test","created_at":"2011-07-20T22:09:23Z","filename":"filename","id":14,"purpose":"RAW_EVENT_LOG","updated_at":"2011-07-20T22:09:23Z"}}]'
74
+ - '158'
75
+ body: ! '[{"s3_file":{"bucket":"test","created_at":"2011-07-26T21:15:03Z","filename":"filename","id":1,"purpose":"RAW_EVENT_LOG","updated_at":"2011-07-26T21:15:03Z"}}]'
76
76
  http_version: '1.1'
77
77
  - !ruby/struct:VCR::HTTPInteraction
78
78
  request: !ruby/struct:VCR::Request
79
79
  method: :get
80
- uri: http://127.0.0.1:3000/s3_files/14.json?api_key=
80
+ uri: http://127.0.0.1:3000/s3_files/1.json?api_key=secret
81
81
  body: !!null
82
82
  headers:
83
83
  accept:
@@ -94,25 +94,25 @@
94
94
  content-type:
95
95
  - application/json; charset=utf-8
96
96
  etag:
97
- - ! '"82de26d0323cc7f9ae7ca9834a9cdad6"'
97
+ - ! '"67aa857a0fae3ef759591bfd7c6ce984"'
98
98
  cache-control:
99
99
  - max-age=0, private, must-revalidate
100
100
  x-ua-compatible:
101
101
  - IE=Edge
102
102
  x-runtime:
103
- - '0.060063'
103
+ - '0.058488'
104
104
  server:
105
105
  - WEBrick/1.3.1 (Ruby/1.9.2/2011-07-09)
106
106
  date:
107
- - Wed, 20 Jul 2011 22:09:24 GMT
107
+ - Tue, 26 Jul 2011 21:15:03 GMT
108
108
  content-length:
109
- - '157'
110
- body: ! '{"s3_file":{"bucket":"test","created_at":"2011-07-20T22:09:23Z","filename":"filename","id":14,"purpose":"RAW_EVENT_LOG","updated_at":"2011-07-20T22:09:23Z"}}'
109
+ - '156'
110
+ body: ! '{"s3_file":{"bucket":"test","created_at":"2011-07-26T21:15:03Z","filename":"filename","id":1,"purpose":"RAW_EVENT_LOG","updated_at":"2011-07-26T21:15:03Z"}}'
111
111
  http_version: '1.1'
112
112
  - !ruby/struct:VCR::HTTPInteraction
113
113
  request: !ruby/struct:VCR::Request
114
114
  method: :get
115
- uri: http://127.0.0.1:3000/s3_files/14.json?api_key=
115
+ uri: http://127.0.0.1:3000/s3_files/1.json?api_key=secret
116
116
  body: !!null
117
117
  headers:
118
118
  accept:
@@ -129,25 +129,25 @@
129
129
  content-type:
130
130
  - application/json; charset=utf-8
131
131
  etag:
132
- - ! '"82de26d0323cc7f9ae7ca9834a9cdad6"'
132
+ - ! '"67aa857a0fae3ef759591bfd7c6ce984"'
133
133
  cache-control:
134
134
  - max-age=0, private, must-revalidate
135
135
  x-ua-compatible:
136
136
  - IE=Edge
137
137
  x-runtime:
138
- - '0.059891'
138
+ - '0.103646'
139
139
  server:
140
140
  - WEBrick/1.3.1 (Ruby/1.9.2/2011-07-09)
141
141
  date:
142
- - Wed, 20 Jul 2011 22:09:24 GMT
142
+ - Tue, 26 Jul 2011 21:15:03 GMT
143
143
  content-length:
144
- - '157'
145
- body: ! '{"s3_file":{"bucket":"test","created_at":"2011-07-20T22:09:23Z","filename":"filename","id":14,"purpose":"RAW_EVENT_LOG","updated_at":"2011-07-20T22:09:23Z"}}'
144
+ - '156'
145
+ body: ! '{"s3_file":{"bucket":"test","created_at":"2011-07-26T21:15:03Z","filename":"filename","id":1,"purpose":"RAW_EVENT_LOG","updated_at":"2011-07-26T21:15:03Z"}}'
146
146
  http_version: '1.1'
147
147
  - !ruby/struct:VCR::HTTPInteraction
148
148
  request: !ruby/struct:VCR::Request
149
149
  method: :put
150
- uri: http://127.0.0.1:3000/s3_files/14.json?api_key=
150
+ uri: http://127.0.0.1:3000/s3_files/1.json?api_key=secret
151
151
  body: !!null
152
152
  headers:
153
153
  accept:
@@ -172,22 +172,22 @@
172
172
  x-ua-compatible:
173
173
  - IE=Edge
174
174
  x-runtime:
175
- - '0.109019'
175
+ - '0.062569'
176
176
  server:
177
177
  - WEBrick/1.3.1 (Ruby/1.9.2/2011-07-09)
178
178
  date:
179
- - Wed, 20 Jul 2011 22:09:24 GMT
179
+ - Tue, 26 Jul 2011 21:15:03 GMT
180
180
  content-length:
181
181
  - '2'
182
182
  set-cookie:
183
- - _neuron-admin_session=BAh7BkkiD3Nlc3Npb25faWQGOgZFRiIlMTM4NmUyZTg3NjMyZmEyODVlYTYzOWMzMDY2ZGVjN2Y%3D--aa8493cea97d5cd46b28e8e4ed590a78c43f527f;
183
+ - _neuron-admin_session=BAh7BkkiD3Nlc3Npb25faWQGOgZFRiIlODcyMjcxYjA1YzMzYjhmY2Q4YTQyY2NmMTg3ZWZlNjM%3D--3ea83e017a27c14576690a4d98b58f12c9c3b480;
184
184
  path=/; HttpOnly
185
185
  body: ! '{}'
186
186
  http_version: '1.1'
187
187
  - !ruby/struct:VCR::HTTPInteraction
188
188
  request: !ruby/struct:VCR::Request
189
189
  method: :get
190
- uri: http://127.0.0.1:3000/s3_files/14.json?api_key=
190
+ uri: http://127.0.0.1:3000/s3_files/1.json?api_key=secret
191
191
  body: !!null
192
192
  headers:
193
193
  accept:
@@ -204,18 +204,18 @@
204
204
  content-type:
205
205
  - application/json; charset=utf-8
206
206
  etag:
207
- - ! '"469eafd0f989f48861aed220036e8b54"'
207
+ - ! '"717dca0db92d340da526fc4e869d36a6"'
208
208
  cache-control:
209
209
  - max-age=0, private, must-revalidate
210
210
  x-ua-compatible:
211
211
  - IE=Edge
212
212
  x-runtime:
213
- - '0.058650'
213
+ - '0.102077'
214
214
  server:
215
215
  - WEBrick/1.3.1 (Ruby/1.9.2/2011-07-09)
216
216
  date:
217
- - Wed, 20 Jul 2011 22:09:24 GMT
217
+ - Tue, 26 Jul 2011 21:15:03 GMT
218
218
  content-length:
219
- - '159'
220
- body: ! '{"s3_file":{"bucket":"test","created_at":"2011-07-20T22:09:23Z","filename":"filename_2","id":14,"purpose":"RAW_EVENT_LOG","updated_at":"2011-07-20T22:09:24Z"}}'
219
+ - '158'
220
+ body: ! '{"s3_file":{"bucket":"test","created_at":"2011-07-26T21:15:03Z","filename":"filename_2","id":1,"purpose":"RAW_EVENT_LOG","updated_at":"2011-07-26T21:15:03Z"}}'
221
221
  http_version: '1.1'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neuron-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,12 +10,12 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2011-07-26 00:00:00.000000000 -05:00
13
+ date: 2011-08-01 00:00:00.000000000 -05:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rest-client
18
- requirement: &2161396140 !ruby/object:Gem::Requirement
18
+ requirement: &2157689420 !ruby/object:Gem::Requirement
19
19
  none: false
20
20
  requirements:
21
21
  - - ! '>='
@@ -23,10 +23,10 @@ dependencies:
23
23
  version: 1.6.3
24
24
  type: :runtime
25
25
  prerelease: false
26
- version_requirements: *2161396140
26
+ version_requirements: *2157689420
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: yajl-ruby
29
- requirement: &2161395640 !ruby/object:Gem::Requirement
29
+ requirement: &2157688920 !ruby/object:Gem::Requirement
30
30
  none: false
31
31
  requirements:
32
32
  - - ! '>='
@@ -34,10 +34,10 @@ dependencies:
34
34
  version: 0.8.2
35
35
  type: :runtime
36
36
  prerelease: false
37
- version_requirements: *2161395640
37
+ version_requirements: *2157688920
38
38
  - !ruby/object:Gem::Dependency
39
39
  name: rspec
40
- requirement: &2161395180 !ruby/object:Gem::Requirement
40
+ requirement: &2157688460 !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
43
  - - ! '>='
@@ -45,10 +45,10 @@ dependencies:
45
45
  version: 2.6.0
46
46
  type: :development
47
47
  prerelease: false
48
- version_requirements: *2161395180
48
+ version_requirements: *2157688460
49
49
  - !ruby/object:Gem::Dependency
50
50
  name: simplecov
51
- requirement: &2161394720 !ruby/object:Gem::Requirement
51
+ requirement: &2157688000 !ruby/object:Gem::Requirement
52
52
  none: false
53
53
  requirements:
54
54
  - - ! '>='
@@ -56,10 +56,10 @@ dependencies:
56
56
  version: 0.4.2
57
57
  type: :development
58
58
  prerelease: false
59
- version_requirements: *2161394720
59
+ version_requirements: *2157688000
60
60
  - !ruby/object:Gem::Dependency
61
61
  name: rb-fsevent
62
- requirement: &2161394220 !ruby/object:Gem::Requirement
62
+ requirement: &2157687500 !ruby/object:Gem::Requirement
63
63
  none: false
64
64
  requirements:
65
65
  - - ! '>='
@@ -67,10 +67,10 @@ dependencies:
67
67
  version: 0.4.1
68
68
  type: :development
69
69
  prerelease: false
70
- version_requirements: *2161394220
70
+ version_requirements: *2157687500
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: guard
73
- requirement: &2161393760 !ruby/object:Gem::Requirement
73
+ requirement: &2157687040 !ruby/object:Gem::Requirement
74
74
  none: false
75
75
  requirements:
76
76
  - - ! '>='
@@ -78,10 +78,10 @@ dependencies:
78
78
  version: 0.5.1
79
79
  type: :development
80
80
  prerelease: false
81
- version_requirements: *2161393760
81
+ version_requirements: *2157687040
82
82
  - !ruby/object:Gem::Dependency
83
83
  name: guard-bundler
84
- requirement: &2161393300 !ruby/object:Gem::Requirement
84
+ requirement: &2157686580 !ruby/object:Gem::Requirement
85
85
  none: false
86
86
  requirements:
87
87
  - - ! '>='
@@ -89,10 +89,10 @@ dependencies:
89
89
  version: 0.1.3
90
90
  type: :development
91
91
  prerelease: false
92
- version_requirements: *2161393300
92
+ version_requirements: *2157686580
93
93
  - !ruby/object:Gem::Dependency
94
94
  name: guard-rspec
95
- requirement: &2161392840 !ruby/object:Gem::Requirement
95
+ requirement: &2157686120 !ruby/object:Gem::Requirement
96
96
  none: false
97
97
  requirements:
98
98
  - - ! '>='
@@ -100,10 +100,10 @@ dependencies:
100
100
  version: 0.4.0
101
101
  type: :development
102
102
  prerelease: false
103
- version_requirements: *2161392840
103
+ version_requirements: *2157686120
104
104
  - !ruby/object:Gem::Dependency
105
105
  name: fakeweb
106
- requirement: &2161392380 !ruby/object:Gem::Requirement
106
+ requirement: &2157685660 !ruby/object:Gem::Requirement
107
107
  none: false
108
108
  requirements:
109
109
  - - ! '>='
@@ -111,10 +111,10 @@ dependencies:
111
111
  version: 1.3.0
112
112
  type: :development
113
113
  prerelease: false
114
- version_requirements: *2161392380
114
+ version_requirements: *2157685660
115
115
  - !ruby/object:Gem::Dependency
116
116
  name: vcr
117
- requirement: &2161391920 !ruby/object:Gem::Requirement
117
+ requirement: &2157685200 !ruby/object:Gem::Requirement
118
118
  none: false
119
119
  requirements:
120
120
  - - ! '>='
@@ -122,7 +122,7 @@ dependencies:
122
122
  version: 1.10.2
123
123
  type: :development
124
124
  prerelease: false
125
- version_requirements: *2161391920
125
+ version_requirements: *2157685200
126
126
  description: Neuron Admin Client Gem
127
127
  email:
128
128
  - devteam@rmmonline.com