adriver_api 0.0.2 → 0.0.3

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: c5545d6fc918ca570d070729c9896b492c8a3c89
4
- data.tar.gz: d2a6806e7afbc10c0a4ef4ed065de95c0d181d9e
3
+ metadata.gz: 609194bdf53a66db0319cc8b22f5766703e12f07
4
+ data.tar.gz: db96ee6d762e97fa30dfbd3bb8a9bc8762ce6307
5
5
  SHA512:
6
- metadata.gz: 67bd50cc2791472f98f4accc6c6048df6b1ae6b819bf6632a8de366d3767fbb484d950fd786b7f65d31f92fda70032f95ec9d8399724e785b414bff84edf5815
7
- data.tar.gz: 6cb76a020b2497493e6328a62a377e35a98cab5b0250a0d7b78eb1be8385cba059ea45b1929dc1a93e31af82c25693623231b7e48011b8c8cdb4a1769cb937fb
6
+ metadata.gz: e03c5a24fea00d91f1d24c65de64ce19365f51a2eb91a88c073ccf420579c8b1874b7fa367ce9c426fd2c93b15f577fabebb267bc4e46d61ea6429933a929d9d
7
+ data.tar.gz: ccd011a4218bd3d817469594fe14efc22ac4b4097a32a0420eb5d94688076e186cbb01a25b72f988ca02a4628bc001df390e713014befa81a6c82321c46b2b07
@@ -14,7 +14,7 @@ module AdriverApi
14
14
  def ads_delegated(raw: false)
15
15
  response = make_request('ads/delegated', user_id: @user_id.to_s)
16
16
  return response if raw
17
- response.body['feed']['entry'].map{|x| x['id'].split('/').last}
17
+ Array(response.body['feed']['entry']).map{|x| x['id'].split('/').last}
18
18
  end
19
19
 
20
20
  # Info about ad
@@ -25,7 +25,7 @@ module AdriverApi
25
25
  h[:id] = response.body['entry']['content']['ad']['id']
26
26
  h[:name] = response.body['entry']['content']['ad']['name']
27
27
  h[:enable] = response.body['entry']['content']['ad']['enable']
28
- h[:adplacements] = response.body['entry']['content']['ad']['adPlacements']['href'].map{|x| x.split('/').last}
28
+ h[:adplacements] = Array(response.body['entry']['content']['ad']['adPlacements']['href']).map{|x| x.split('/').last}
29
29
  h
30
30
  end
31
31
 
@@ -33,7 +33,8 @@ module AdriverApi
33
33
  def adplacements(ad_id, raw: false)
34
34
  response = make_request('adplacements', ad_id: ad_id)
35
35
  return response if raw
36
- [response.body['feed']['entry']].flatten.map{|x| {id: x['content']['adPlacement']['id'], name: x['content']['adPlacement']['name'], banners: x['content']['adPlacement']['banners'] ? x['content']['adPlacement']['banners']['href'].map{|x2| x2.split('/').last} : []} }
36
+ #TODO: иногда массив, иногда строка
37
+ Array(response.body['feed']['entry']).map{|x| {id: x['content']['adPlacement']['id'], name: x['content']['adPlacement']['name'], banners: x['content']['adPlacement']['banners'] ? Array(x['content']['adPlacement']['banners']['href']).map{|x2| x2.split('/').last} : []} }
37
38
  end
38
39
 
39
40
  def banner(ban_id)
@@ -44,7 +45,7 @@ module AdriverApi
44
45
  response = make_request("stat/banners/#{ban_id}", start_date: start_date, stop_date: stop_date, granularity: period)
45
46
  return response if raw
46
47
  h = {}
47
- response.body['entry']['content']['statObject']['stat']['item'].each{|x| h[x['date']] = {views: x['exp'], clicks: x['click']} }
48
+ Array(response.body['entry']['content']['statObject']['stat']['item']).each{|x| h[x['date']] = {views: x['exp'], clicks: x['click']} }
48
49
  h
49
50
  end
50
51
 
@@ -1,3 +1,3 @@
1
1
  module AdriverApi
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adriver_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexey Yudin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-10 00:00:00.000000000 Z
11
+ date: 2017-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler