citygrid_api 0.0.5 → 0.0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.sass-cache/7a5a675d951455410512a59af5ab2d160bd1735c/test.scssc +0 -0
- data/Gemfile +10 -8
- data/Gemfile.lock +24 -9
- data/README +21 -0
- data/citygrid_api.gemspec +77 -17
- data/citygrid_api.yml.sample +33 -0
- data/config.ru +2 -0
- data/dashboard.rb +110 -0
- data/lib/citygrid/abstraction/collection.rb +1 -1
- data/lib/citygrid/abstraction/super_hash.rb +2 -0
- data/lib/citygrid/api/ad_center/account.rb +26 -0
- data/lib/citygrid/api/ad_center/account_manager.rb +8 -0
- data/lib/citygrid/api/ad_center/ad_group.rb +8 -0
- data/lib/citygrid/api/ad_center/ad_group_ad.rb +8 -0
- data/lib/citygrid/api/ad_center/ad_group_criterion.rb +8 -0
- data/lib/citygrid/api/ad_center/ad_group_geo.rb +8 -0
- data/lib/citygrid/api/ad_center/authentication.rb +20 -0
- data/lib/citygrid/api/ad_center/billing.rb +8 -0
- data/lib/citygrid/api/ad_center/budget.rb +9 -0
- data/lib/citygrid/api/ad_center/call_detail.rb +25 -0
- data/lib/citygrid/api/ad_center/campaign.rb +8 -0
- data/lib/citygrid/api/ad_center/category.rb +9 -0
- data/lib/citygrid/api/ad_center/geolocation.rb +9 -0
- data/lib/citygrid/api/ad_center/image.rb +30 -0
- data/lib/citygrid/api/ad_center/method_of_payment.rb +10 -0
- data/lib/citygrid/api/ad_center/performance.rb +17 -0
- data/lib/citygrid/api/ad_center/places.rb +8 -0
- data/lib/citygrid/api/ad_center/user.rb +8 -0
- data/lib/citygrid/api/ad_center.rb +20 -0
- data/lib/citygrid/api/content/offers.rb +14 -9
- data/lib/citygrid/api/content/places/detail.rb +5 -11
- data/lib/citygrid/api/content/places/search.rb +5 -11
- data/lib/citygrid/api/content/places.rb +30 -14
- data/lib/citygrid/api/content/reviews.rb +5 -10
- data/lib/citygrid/api/content.rb +12 -3
- data/lib/citygrid/api/response.rb +2 -2
- data/lib/citygrid/api.rb +190 -3
- data/lib/citygrid/details.rb +1 -1
- data/lib/citygrid/listing.rb +7 -2
- data/lib/citygrid/offers.rb +4 -0
- data/lib/citygrid/reviews.rb +4 -0
- data/lib/citygrid/search.rb +6 -0
- data/lib/citygrid.rb +117 -12
- data/lib/dashboard/sinatra_partial.rb +17 -0
- data/lib/dashboard/stored_reporter.rb +101 -0
- data/lib/dashboard/test_result.rb +8 -0
- data/lib/request_ext.rb +32 -0
- data/public/javascript/dashboard.js +5 -0
- data/test/api/ad_center/test_account.rb +120 -0
- data/test/api/ad_center/test_ad_group.rb +50 -0
- data/test/api/ad_center/test_ad_group_ad.rb +27 -0
- data/test/api/ad_center/test_ad_group_criterion.rb +37 -0
- data/test/api/ad_center/test_ad_group_geo.rb +19 -0
- data/test/api/ad_center/test_authentication.rb +22 -0
- data/test/api/ad_center/test_billing.rb +14 -0
- data/test/api/ad_center/test_budget.rb +13 -0
- data/test/api/ad_center/test_call_detail.rb +36 -0
- data/test/api/ad_center/test_campaign.rb +27 -0
- data/test/api/ad_center/test_category.rb +37 -0
- data/test/api/ad_center/test_geolocation.rb +19 -0
- data/test/api/ad_center/test_image.rb +17 -0
- data/test/api/ad_center/test_method_of_payment.rb +51 -0
- data/test/api/ad_center/test_places.rb +79 -0
- data/test/api/ad_center/test_reports.rb +37 -0
- data/test/api/content/test_offers.rb +28 -0
- data/test/api/content/test_places.rb +66 -0
- data/test/helper.rb +67 -14
- data/test/test_config.rb +11 -0
- data/test/test_details.rb +14 -5
- data/test/test_img.jpg +0 -0
- data/test/test_img_big.png +0 -0
- data/test/test_listing.rb +64 -64
- data/test/test_search.rb +21 -1
- data/test/test_super_array.rb +1 -1
- data/test/test_super_hash.rb +1 -1
- data/views/_context_result.haml +25 -0
- data/views/_request.haml +3 -0
- data/views/_test_result.haml +4 -0
- data/views/stylesheets/test.scss +53 -0
- data/views/test.haml +8 -0
- metadata +145 -114
- data/lib/citygrid/api/base.rb +0 -60
- data/test/test_citygrid.rb +0 -7
metadata
CHANGED
@@ -1,134 +1,126 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: citygrid_api
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.5.1
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 5
|
10
|
-
version: 0.0.5
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Elpizo Choi
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
12
|
+
date: 2011-12-17 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: httparty
|
16
|
+
requirement: &2153153500 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.8.1
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *2153153500
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: json
|
27
|
+
requirement: &2153152460 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - =
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.5.3
|
21
33
|
type: :runtime
|
22
|
-
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *2153152460
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: riot
|
38
|
+
requirement: &2153151200 !ruby/object:Gem::Requirement
|
23
39
|
none: false
|
24
|
-
requirements:
|
40
|
+
requirements:
|
25
41
|
- - ~>
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
|
28
|
-
|
29
|
-
- 0
|
30
|
-
- 7
|
31
|
-
- 8
|
32
|
-
version: 0.7.8
|
33
|
-
version_requirements: *id001
|
34
|
-
name: httparty
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 0.12.4
|
44
|
+
type: :runtime
|
35
45
|
prerelease: false
|
36
|
-
|
37
|
-
|
38
|
-
|
46
|
+
version_requirements: *2153151200
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: awesome_print
|
49
|
+
requirement: &2153149840 !ruby/object:Gem::Requirement
|
39
50
|
none: false
|
40
|
-
requirements:
|
51
|
+
requirements:
|
41
52
|
- - ~>
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
hash: 15
|
44
|
-
segments:
|
45
|
-
- 0
|
46
|
-
- 4
|
47
|
-
- 0
|
53
|
+
- !ruby/object:Gem::Version
|
48
54
|
version: 0.4.0
|
49
|
-
|
50
|
-
name: awesome_print
|
55
|
+
type: :runtime
|
51
56
|
prerelease: false
|
52
|
-
|
53
|
-
|
54
|
-
|
57
|
+
version_requirements: *2153149840
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: haml
|
60
|
+
requirement: &2153148940 !ruby/object:Gem::Requirement
|
55
61
|
none: false
|
56
|
-
requirements:
|
57
|
-
- -
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
|
60
|
-
|
61
|
-
- 0
|
62
|
-
- 12
|
63
|
-
- 4
|
64
|
-
version: 0.12.4
|
65
|
-
version_requirements: *id003
|
66
|
-
name: riot
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
|
69
|
-
|
70
|
-
|
68
|
+
version_requirements: *2153148940
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: bundler
|
71
|
+
requirement: &2153147700 !ruby/object:Gem::Requirement
|
71
72
|
none: false
|
72
|
-
requirements:
|
73
|
+
requirements:
|
73
74
|
- - ~>
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
hash: 23
|
76
|
-
segments:
|
77
|
-
- 1
|
78
|
-
- 0
|
79
|
-
- 0
|
75
|
+
- !ruby/object:Gem::Version
|
80
76
|
version: 1.0.0
|
81
|
-
version_requirements: *id004
|
82
|
-
name: bundler
|
83
|
-
prerelease: false
|
84
|
-
- !ruby/object:Gem::Dependency
|
85
77
|
type: :development
|
86
|
-
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *2153147700
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: jeweler
|
82
|
+
requirement: &2153146680 !ruby/object:Gem::Requirement
|
87
83
|
none: false
|
88
|
-
requirements:
|
84
|
+
requirements:
|
89
85
|
- - ~>
|
90
|
-
- !ruby/object:Gem::Version
|
91
|
-
hash: 11
|
92
|
-
segments:
|
93
|
-
- 1
|
94
|
-
- 6
|
95
|
-
- 2
|
86
|
+
- !ruby/object:Gem::Version
|
96
87
|
version: 1.6.2
|
97
|
-
version_requirements: *id005
|
98
|
-
name: jeweler
|
99
|
-
prerelease: false
|
100
|
-
- !ruby/object:Gem::Dependency
|
101
88
|
type: :development
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
- - ">="
|
106
|
-
- !ruby/object:Gem::Version
|
107
|
-
hash: 3
|
108
|
-
segments:
|
109
|
-
- 0
|
110
|
-
version: "0"
|
111
|
-
version_requirements: *id006
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: *2153146680
|
91
|
+
- !ruby/object:Gem::Dependency
|
112
92
|
name: rcov
|
93
|
+
requirement: &2153139180 !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ! '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
type: :development
|
113
100
|
prerelease: false
|
101
|
+
version_requirements: *2153139180
|
114
102
|
description: Ruby wrapper for CityGrid APIs
|
115
103
|
email: fu7iin@gmail.com
|
116
104
|
executables: []
|
117
|
-
|
118
105
|
extensions: []
|
119
|
-
|
120
|
-
extra_rdoc_files:
|
106
|
+
extra_rdoc_files:
|
121
107
|
- LICENSE.txt
|
108
|
+
- README
|
122
109
|
- README.rdoc
|
123
|
-
files:
|
110
|
+
files:
|
124
111
|
- .document
|
112
|
+
- .sass-cache/7a5a675d951455410512a59af5ab2d160bd1735c/test.scssc
|
125
113
|
- Gemfile
|
126
114
|
- Gemfile.lock
|
127
115
|
- LICENSE.txt
|
116
|
+
- README
|
128
117
|
- README.rdoc
|
129
118
|
- Rakefile
|
130
119
|
- VERSION
|
131
120
|
- citygrid_api.gemspec
|
121
|
+
- citygrid_api.yml.sample
|
122
|
+
- config.ru
|
123
|
+
- dashboard.rb
|
132
124
|
- lib/citygrid.rb
|
133
125
|
- lib/citygrid/abstraction.rb
|
134
126
|
- lib/citygrid/abstraction/collection.rb
|
@@ -137,7 +129,25 @@ files:
|
|
137
129
|
- lib/citygrid/abstraction/super_array.rb
|
138
130
|
- lib/citygrid/abstraction/super_hash.rb
|
139
131
|
- lib/citygrid/api.rb
|
140
|
-
- lib/citygrid/api/
|
132
|
+
- lib/citygrid/api/ad_center.rb
|
133
|
+
- lib/citygrid/api/ad_center/account.rb
|
134
|
+
- lib/citygrid/api/ad_center/account_manager.rb
|
135
|
+
- lib/citygrid/api/ad_center/ad_group.rb
|
136
|
+
- lib/citygrid/api/ad_center/ad_group_ad.rb
|
137
|
+
- lib/citygrid/api/ad_center/ad_group_criterion.rb
|
138
|
+
- lib/citygrid/api/ad_center/ad_group_geo.rb
|
139
|
+
- lib/citygrid/api/ad_center/authentication.rb
|
140
|
+
- lib/citygrid/api/ad_center/billing.rb
|
141
|
+
- lib/citygrid/api/ad_center/budget.rb
|
142
|
+
- lib/citygrid/api/ad_center/call_detail.rb
|
143
|
+
- lib/citygrid/api/ad_center/campaign.rb
|
144
|
+
- lib/citygrid/api/ad_center/category.rb
|
145
|
+
- lib/citygrid/api/ad_center/geolocation.rb
|
146
|
+
- lib/citygrid/api/ad_center/image.rb
|
147
|
+
- lib/citygrid/api/ad_center/method_of_payment.rb
|
148
|
+
- lib/citygrid/api/ad_center/performance.rb
|
149
|
+
- lib/citygrid/api/ad_center/places.rb
|
150
|
+
- lib/citygrid/api/ad_center/user.rb
|
141
151
|
- lib/citygrid/api/content.rb
|
142
152
|
- lib/citygrid/api/content/offers.rb
|
143
153
|
- lib/citygrid/api/content/places.rb
|
@@ -151,46 +161,67 @@ files:
|
|
151
161
|
- lib/citygrid/reviews.rb
|
152
162
|
- lib/citygrid/search.rb
|
153
163
|
- lib/citygrid_api.rb
|
164
|
+
- lib/dashboard/sinatra_partial.rb
|
165
|
+
- lib/dashboard/stored_reporter.rb
|
166
|
+
- lib/dashboard/test_result.rb
|
167
|
+
- lib/request_ext.rb
|
168
|
+
- public/javascript/dashboard.js
|
169
|
+
- test/api/ad_center/test_account.rb
|
170
|
+
- test/api/ad_center/test_ad_group.rb
|
171
|
+
- test/api/ad_center/test_ad_group_ad.rb
|
172
|
+
- test/api/ad_center/test_ad_group_criterion.rb
|
173
|
+
- test/api/ad_center/test_ad_group_geo.rb
|
174
|
+
- test/api/ad_center/test_authentication.rb
|
175
|
+
- test/api/ad_center/test_billing.rb
|
176
|
+
- test/api/ad_center/test_budget.rb
|
177
|
+
- test/api/ad_center/test_call_detail.rb
|
178
|
+
- test/api/ad_center/test_campaign.rb
|
179
|
+
- test/api/ad_center/test_category.rb
|
180
|
+
- test/api/ad_center/test_geolocation.rb
|
181
|
+
- test/api/ad_center/test_image.rb
|
182
|
+
- test/api/ad_center/test_method_of_payment.rb
|
183
|
+
- test/api/ad_center/test_places.rb
|
184
|
+
- test/api/ad_center/test_reports.rb
|
185
|
+
- test/api/content/test_offers.rb
|
186
|
+
- test/api/content/test_places.rb
|
154
187
|
- test/helper.rb
|
155
188
|
- test/publisher_helper.rb.sample
|
156
|
-
- test/
|
189
|
+
- test/test_config.rb
|
157
190
|
- test/test_details.rb
|
191
|
+
- test/test_img.jpg
|
192
|
+
- test/test_img_big.png
|
158
193
|
- test/test_listing.rb
|
159
194
|
- test/test_search.rb
|
160
195
|
- test/test_super_array.rb
|
161
196
|
- test/test_super_hash.rb
|
197
|
+
- views/_context_result.haml
|
198
|
+
- views/_request.haml
|
199
|
+
- views/_test_result.haml
|
200
|
+
- views/stylesheets/test.scss
|
201
|
+
- views/test.haml
|
162
202
|
homepage:
|
163
|
-
licenses:
|
203
|
+
licenses:
|
164
204
|
- MIT
|
165
205
|
post_install_message:
|
166
206
|
rdoc_options: []
|
167
|
-
|
168
|
-
require_paths:
|
207
|
+
require_paths:
|
169
208
|
- lib
|
170
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
209
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
171
210
|
none: false
|
172
|
-
requirements:
|
173
|
-
- -
|
174
|
-
- !ruby/object:Gem::Version
|
175
|
-
|
176
|
-
|
177
|
-
- 0
|
178
|
-
version: "0"
|
179
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
211
|
+
requirements:
|
212
|
+
- - ! '>='
|
213
|
+
- !ruby/object:Gem::Version
|
214
|
+
version: '0'
|
215
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
180
216
|
none: false
|
181
|
-
requirements:
|
182
|
-
- -
|
183
|
-
- !ruby/object:Gem::Version
|
184
|
-
|
185
|
-
segments:
|
186
|
-
- 0
|
187
|
-
version: "0"
|
217
|
+
requirements:
|
218
|
+
- - ! '>='
|
219
|
+
- !ruby/object:Gem::Version
|
220
|
+
version: '0'
|
188
221
|
requirements: []
|
189
|
-
|
190
222
|
rubyforge_project:
|
191
|
-
rubygems_version: 1.
|
223
|
+
rubygems_version: 1.8.12
|
192
224
|
signing_key:
|
193
225
|
specification_version: 3
|
194
226
|
summary: Ruby wrapper for CityGrid APIs
|
195
227
|
test_files: []
|
196
|
-
|
data/lib/citygrid/api/base.rb
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
require "httparty"
|
2
|
-
|
3
|
-
class CityGrid
|
4
|
-
module API
|
5
|
-
module Base
|
6
|
-
class << self
|
7
|
-
def included base
|
8
|
-
base.instance_eval do
|
9
|
-
include HTTParty
|
10
|
-
extend ClassMethods
|
11
|
-
base_uri "api.citygridmedia.com/content"
|
12
|
-
format :json
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
module ClassMethods
|
18
|
-
def endpoint
|
19
|
-
# Specified for each API
|
20
|
-
end
|
21
|
-
|
22
|
-
def publisher
|
23
|
-
CityGrid.publisher
|
24
|
-
end
|
25
|
-
|
26
|
-
def request options = {}
|
27
|
-
query = options.merge :publisher => publisher, :format => "json"
|
28
|
-
response = get endpoint, :query => query
|
29
|
-
|
30
|
-
if !response["errors"] || response["errors"].empty?
|
31
|
-
CityGrid::API::Response.new response
|
32
|
-
else
|
33
|
-
raise Error.new response["errors"], response
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
private
|
38
|
-
|
39
|
-
def convert_to_querystring hash
|
40
|
-
hash.map do |k, v|
|
41
|
-
key = URI.escape k.to_s, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]")
|
42
|
-
val = URI.escape v.to_s, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]")
|
43
|
-
!value.empty? && !key.empty? ? "#{key}=#{value}" : nil
|
44
|
-
end.compact.join("&")
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
# Throws error with message from API
|
50
|
-
# HTTParty response is available if this class is rescued
|
51
|
-
class Error < StandardError
|
52
|
-
attr_reader :httparty
|
53
|
-
|
54
|
-
def initialize errors, response = nil
|
55
|
-
@httparty = response
|
56
|
-
super errors.first["error"]
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
data/test/test_citygrid.rb
DELETED