baidu 2.0.4 → 2.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e37178c85f6521e658f59cf8c8c3249e8e1492e7
4
- data.tar.gz: ae7378591b0e813359a7deea907d1e8291174834
3
+ metadata.gz: 03f12556861926d4905226e9f275d9ed221cb95c
4
+ data.tar.gz: da93ba8b348995e7dd7b27b5af0d6984f36c7ab2
5
5
  SHA512:
6
- metadata.gz: 4d9a6405a089e4b2ddea08558ebfaeb2d0c17186d8730d865f2e79aae1191daca2f8cdbbccc5b2e3438fc2b5052b6b2faf1204079887825cd2ba5093e293f48b
7
- data.tar.gz: c48d4431fe582fa0ce8c4567145598fad25c80a674520c7edea4b13298f3610f86de6141cb230730eb3efa6877894bb06a91f22d74c838ab1d3d4b6b1ad2c170
6
+ metadata.gz: 6e909c69519d4e9dc6874bbc1318d2406a67e60cc374037f4d5af0b9227712bb2fe2872c2a85ea8660ad96c193c53a727875de834f849b5c3d0cef60b63a6a4e
7
+ data.tar.gz: 8c0104c251f2147747569a69760d40507e2daf602d5294650e6c8ac5cd9a594769d05ff581af8d5f2646a82f9c1b9742c9a34978d9ca3611d7aaa350ecc439a3
data/.gitignore CHANGED
@@ -3,6 +3,7 @@
3
3
  .bundle
4
4
  .config
5
5
  .yardoc
6
+ .DS_Store
6
7
  Gemfile.lock
7
8
  InstalledFiles
8
9
  _yardoc
data/README.md CHANGED
@@ -18,7 +18,7 @@ Or install it yourself as:
18
18
 
19
19
  $ gem install baidu
20
20
 
21
- ## Knowledge
21
+ ## Acknowledged
22
22
  camel命名法,用于request数据格式
23
23
  snake命名法,用于response数据格式
24
24
 
@@ -26,6 +26,7 @@ snake命名法,用于response数据格式
26
26
  先修改spec/spec_helper.rb
27
27
 
28
28
  ```ruby
29
+
29
30
  BAIDU_MAP_KEY = ''
30
31
  $username = ''
31
32
  $password = ''
@@ -62,7 +63,7 @@ MAP
62
63
  #2xx 无权限
63
64
  #3xx 配额错误
64
65
  puts map.get_xy_by_poiname('滨海公园','上海')
65
- map = Baidumap.new('key')
66
+ map = Baidu::Map.new('key')
66
67
  require 'awesome_print'
67
68
  lat = 40.3377039331399
68
69
  lng = 116.647588831718
@@ -73,6 +74,439 @@ Baidumap.get_baike('北京站')
73
74
  Baidumap.get_cityid('北京') #=>131
74
75
  ```
75
76
 
77
+ ##Documents
78
+
79
+
80
+ ###RankingService
81
+
82
+
83
+ ####方法
84
+
85
+
86
+ #####getPreview
87
+
88
+
89
+ Request: GetPreviewRequest
90
+
91
+ 属性名 | 类型 | 意义 | 限制 | 说明
92
+ ----------------|---------------|-------------|---------------|-----------------
93
+ keyWords | List String | 关键词字面 | 必填 |目前最多输入5个关键词,超过报错。
94
+ device | int | 设备类型 | 必填 | 0:PC 目前只支持PC的推广实况,移动推广实况会于近期推出|
95
+ region | int | 地域代码 |必填 | 目前支持二级地域,地域对照表详见《地域对照表》
96
+ page | int | 页码 | 选填|推广实况的页码,从0开始为第一页
97
+ display | int | 数据展现方式 | 必填 |0:html 该字段为预留字段,目前只支持HTML格式的数据返回方式
98
+
99
+ Response:GetPreviewResponse
100
+
101
+ 属性名 | 类型 | 说明
102
+ ---------|--------|----------
103
+ previewInfos | List<PreviewInfo> | 关键词的推广实况数据(html格式)
104
+
105
+ ResponseFormat:PreviewInfo
106
+
107
+ 属性名 | 类型 | 说明 | 限制
108
+ ---------|-------|-----|------
109
+ keyword | String | 关键词字面 | -
110
+ data | String | 使用gzip进行压缩的推广实况的HTML数据, 解压缩之前请将用base64解码,然后gzip解压,解压后再使用utf-8编码转换为String,即为推广实况的实际HTML数据 | -
111
+
112
+ ####
113
+ ####区域代码
114
+
115
+ 地域代码 地域名称
116
+
117
+ ```
118
+ 1 北京
119
+ 2 上海
120
+ 3 天津
121
+ 4 广东
122
+ 5 福建
123
+ 7 日本
124
+ 8 海南
125
+ 9 安徽
126
+ 10 贵州
127
+ 11 甘肃
128
+ 12 广西
129
+ 13 河北
130
+ 14 河南
131
+ 15 黑龙江
132
+ 16 湖北
133
+ 17 湖南
134
+ 18 吉林
135
+ 19 江苏
136
+ 20 江西
137
+ 21 辽宁
138
+ 22 内蒙古
139
+ 23 宁夏
140
+ 24 青海
141
+ 25 山东
142
+ 26 山西
143
+ 27 陕西
144
+ 28 四川
145
+ 29 西藏
146
+ 30 新疆
147
+ 31 云南
148
+ 32 浙江
149
+ 33 重庆
150
+ 34 香港
151
+ 35 台湾
152
+ 36 澳门
153
+ 37 其他国家
154
+ 82 江门
155
+ 83 揭阳
156
+ 84 广州
157
+ 85 潮州
158
+ 86 茂名
159
+ 88 梅州
160
+ 89 清远
161
+ 90 佛山
162
+ 91 汕头
163
+ 92 汕尾
164
+ 93 深圳
165
+ 94 韶关
166
+ 109 阳江
167
+ 110 湛江
168
+ 111 云浮
169
+ 112 中山
170
+ 113 珠海
171
+ 114 肇庆
172
+ 115 河源
173
+ 116 东莞
174
+ 117 惠州
175
+ 48 莆田
176
+ 49 南平
177
+ 50 龙岩
178
+ 51 宁德
179
+ 52 泉州
180
+ 66 三明
181
+ 70 厦门
182
+ 80 漳州
183
+ 81 福州
184
+ 296 东方
185
+ 297 琼海
186
+ 298 三亚
187
+ 299 文昌
188
+ 300 五指山
189
+ 301 万宁
190
+ 302 海口
191
+ 303 儋州
192
+ 127 淮北
193
+ 128 安庆
194
+ 129 巢湖
195
+ 130 池州
196
+ 131 滁州
197
+ 132 黄山
198
+ 133 淮南
199
+ 134 马鞍山
200
+ 135 六安
201
+ 136 宣城
202
+ 137 宿州
203
+ 138 铜陵
204
+ 139 芜湖
205
+ 140 阜阳
206
+ 141 蚌埠
207
+ 142 合肥
208
+ 143 亳州
209
+ 118 贵阳
210
+ 119 安顺
211
+ 120 六盘水
212
+ 121 黔南
213
+ 122 黔东南
214
+ 123 黔西南
215
+ 124 毕节
216
+ 125 铜仁
217
+ 126 遵义
218
+ 255 酒泉
219
+ 256 金昌
220
+ 257 嘉峪关
221
+ 258 兰州
222
+ 259 陇南
223
+ 260 平凉
224
+ 261 临夏
225
+ 262 庆阳
226
+ 263 定西
227
+ 264 武威
228
+ 265 天水
229
+ 266 张掖
230
+ 267 白银
231
+ 477 甘南
232
+ 95 桂林
233
+ 96 贵港
234
+ 98 防城港
235
+ 99 南宁
236
+ 100 来宾
237
+ 101 柳州
238
+ 102 钦州
239
+ 103 梧州
240
+ 104 北海
241
+ 105 玉林
242
+ 106 河池
243
+ 107 贺州
244
+ 108 百色
245
+ 478 崇左
246
+ 304 保定
247
+ 305 沧州
248
+ 306 承德
249
+ 307 廊坊
250
+ 325 秦皇岛
251
+ 326 邢台
252
+ 327 石家庄
253
+ 329 唐山
254
+ 330 邯郸
255
+ 331 张家口
256
+ 332 衡水
257
+ 308 焦作
258
+ 309 安阳
259
+ 310 开封
260
+ 311 洛阳
261
+ 312 漯河
262
+ 313 平顶山
263
+ 314 驻马店
264
+ 315 南阳
265
+ 316 濮阳
266
+ 317 新乡
267
+ 318 信阳
268
+ 319 许昌
269
+ 320 商丘
270
+ 321 三门峡
271
+ 322 郑州
272
+ 323 鹤壁
273
+ 324 周口
274
+ 476 济源
275
+ 333 鸡西
276
+ 334 佳木斯
277
+ 335 哈尔滨
278
+ 336 牡丹江
279
+ 337 齐齐哈尔
280
+ 338 七台河
281
+ 339 绥化
282
+ 340 双鸭山
283
+ 341 伊春
284
+ 342 大庆
285
+ 343 大兴安岭
286
+ 344 鹤岗
287
+ 345 黑河
288
+ 346 荆门
289
+ 347 荆州
290
+ 348 黄石
291
+ 349 黄冈
292
+ 364 潜江
293
+ 365 孝感
294
+ 366 恩施
295
+ 367 随州
296
+ 368 神农架
297
+ 369 十堰
298
+ 370 襄樊
299
+ 371 武汉
300
+ 372 仙桃
301
+ 373 天门
302
+ 375 咸宁
303
+ 376 宜昌
304
+ 377 鄂州
305
+ 350 怀化
306
+ 351 常德
307
+ 352 长沙
308
+ 353 郴州
309
+ 354 娄底
310
+ 355 邵阳
311
+ 356 湘潭
312
+ 357 湘西
313
+ 358 张家界
314
+ 359 益阳
315
+ 360 衡阳
316
+ 361 岳阳
317
+ 362 永州
318
+ 363 株洲
319
+ 38 吉林
320
+ 39 白城
321
+ 40 长春
322
+ 41 辽源
323
+ 42 白山
324
+ 43 四平
325
+ 44 松原
326
+ 45 通化
327
+ 47 延边
328
+ 53 淮安
329
+ 54 常州
330
+ 55 南京
331
+ 56 南通
332
+ 57 连云港
333
+ 58 徐州
334
+ 59 苏州
335
+ 60 宿迁
336
+ 61 泰州
337
+ 62 无锡
338
+ 63 盐城
339
+ 64 扬州
340
+ 65 镇江
341
+ 67 九江
342
+ 68 吉安
343
+ 69 景德镇
344
+ 71 萍乡
345
+ 72 南昌
346
+ 73 新余
347
+ 74 上饶
348
+ 75 宜春
349
+ 76 鹰潭
350
+ 77 赣州
351
+ 78 抚州
352
+ 144 丹东
353
+ 145 本溪
354
+ 146 锦州
355
+ 147 朝阳
356
+ 148 辽阳
357
+ 149 盘锦
358
+ 150 阜新
359
+ 151 鞍山
360
+ 152 抚顺
361
+ 153 沈阳
362
+ 154 铁岭
363
+ 155 大连
364
+ 156 营口
365
+ 157 葫芦岛
366
+ 158 赤峰
367
+ 159 阿拉善盟
368
+ 160 兴安盟
369
+ 161 通辽
370
+ 162 巴彦淖尔
371
+ 163 乌兰察布
372
+ 164 乌海
373
+ 165 锡林郭勒盟
374
+ 166 呼伦贝尔
375
+ 167 呼和浩特
376
+ 168 鄂尔多斯
377
+ 169 包头
378
+ 170 固原
379
+ 171 石嘴山
380
+ 172 吴忠
381
+ 173 中卫
382
+ 174 银川
383
+ 175 西宁
384
+ 176 海东
385
+ 177 海西
386
+ 178 玉树
387
+ 479 海南
388
+ 196 济南
389
+ 197 济宁
390
+ 198 莱芜
391
+ 199 聊城
392
+ 200 德州
393
+ 201 临沂
394
+ 202 青岛
395
+ 203 日照
396
+ 204 潍坊
397
+ 207 淄博
398
+ 208 泰安
399
+ 218 威海
400
+ 219 烟台
401
+ 220 东营
402
+ 221 枣庄
403
+ 222 菏泽
404
+ 223 滨州
405
+ 205 晋城
406
+ 206 晋中
407
+ 209 长治
408
+ 210 吕梁
409
+ 211 临汾
410
+ 212 忻州
411
+ 213 朔州
412
+ 214 太原
413
+ 215 阳泉
414
+ 216 运城
415
+ 217 大同
416
+ 239 宝鸡
417
+ 240 安康
418
+ 241 商洛
419
+ 242 铜川
420
+ 243 渭南
421
+ 244 西安
422
+ 245 咸阳
423
+ 246 延安
424
+ 248 汉中
425
+ 249 榆林
426
+ 224 广安
427
+ 225 广元
428
+ 226 成都
429
+ 227 眉山
430
+ 228 凉山
431
+ 229 绵阳
432
+ 230 攀枝花
433
+ 231 南充
434
+ 232 德阳
435
+ 233 乐山
436
+ 234 泸州
437
+ 235 内江
438
+ 236 甘孜
439
+ 237 遂宁
440
+ 238 资阳
441
+ 247 巴中
442
+ 250 达州
443
+ 251 雅安
444
+ 252 阿坝
445
+ 253 自贡
446
+ 254 宜宾
447
+ 268 那曲
448
+ 269 拉萨
449
+ 270 林芝
450
+ 271 日喀则
451
+ 480 昌都
452
+ 179 哈密
453
+ 180 博尔塔拉
454
+ 181 昌吉
455
+ 182 阿勒泰
456
+ 183 喀什
457
+ 184 克拉玛依
458
+ 185 阿克苏
459
+ 186 克孜勒苏柯尔克孜
460
+ 187 石河子
461
+ 188 塔城
462
+ 189 五家渠
463
+ 190 吐鲁番
464
+ 191 巴音郭楞
465
+ 192 乌鲁木齐
466
+ 193 伊犁
467
+ 195 和田
468
+ 283 楚雄
469
+ 284 昆明
470
+ 285 丽江
471
+ 286 德宏
472
+ 287 临沧
473
+ 288 曲靖
474
+ 289 保山
475
+ 290 普洱
476
+ 291 文山
477
+ 292 大理
478
+ 293 红河
479
+ 294 昭通
480
+ 295 玉溪
481
+ 481 怒江
482
+ 482 迪庆
483
+ 483 西双版纳
484
+ 272 金华
485
+ 273 嘉兴
486
+ 274 衢州
487
+ 275 丽水
488
+ 276 宁波
489
+ 277 绍兴
490
+ 278 温州
491
+ 279 台州
492
+ 280 杭州
493
+ 281 舟山
494
+ 282 湖州
495
+ ```
496
+
497
+ ####错误代码
498
+
499
+ ```
500
+ 90191801=The request keyword number is zero
501
+ 90191802=The request keyword number is more than maximum
502
+ 90191803=The request device code is neither 0(PC) nor 1(MOBILE)
503
+ 90191804=The request display code is neither 0(HTML) nor 1(Structure)
504
+ 90191805=The request page number is invalid
505
+ 90191806=The request region code is invalid
506
+ 90191807=The Server is too busy to response, please try again later
507
+ 90191808=Server internal error, please check your request and try again later.
508
+ ```
509
+
76
510
  ## Contributing
77
511
 
78
512
  1. Fork it
Binary file
@@ -1,61 +1,7 @@
1
- module Baidu
2
- module Rank
3
- end
4
- module SEM
5
- end
6
- end
7
-
8
- class String
9
- def snake_case
10
- self.gsub(/::/, '/').
11
- gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
12
- gsub(/([a-z\d])([A-Z])/,'\1_\2').
13
- tr("-", "_").
14
- downcase
15
- end
16
- end
17
- class Savon
18
- class Response
19
- def header
20
- hash[:envelope][:header]
21
- end
22
- def res_header
23
- header[:res_header]
24
- end
25
- def desc
26
- res_header[:desc]
27
- end
28
- def quota
29
- res_header[:quota]
30
- end
31
- def rquota
32
- res_header[:rquota]
33
- end
34
- def oprs
35
- res_header[:oprs]
36
- end
37
- def oprtime
38
- res_header[:oprtime]
39
- end
40
- def failures
41
- res_header[:failures]
42
- end
43
- def code
44
- failures[:code] if failures
45
- end
46
- def message
47
- failures[:message] if failures
48
- end
49
- def status
50
- res_header[:status]
51
- end
52
- end
53
- end
54
1
  require "baidu/version"
55
2
  require "baidu/map"
56
3
  require "baidu/translate"
57
4
  require "baidu/sem"
58
- require "baidu/rank"
59
5
  require "baidu/auth"
60
6
  require "baidu/response"
61
7
  require "ext"
@@ -1,66 +1,98 @@
1
1
  require 'httparty'
2
2
  module Baidu
3
- class Map
4
- include HTTParty
5
- def initialize(key)
6
- @key = key
7
- @segments = {:ak=>@key,:output=>'json',:radius=>1000}
8
- end
3
+ module Map
4
+ class Place
5
+ include HTTParty
6
+ HOST = 'api.map.baidu.com'
7
+ @service_path = '/place/v2'
8
+ def initialize(ak,pagesize=10,page_num=0,scope=2)
9
+ @ak = ak
10
+ @segments = {:ak=>@ak,:output=>'json',:pagesize=>pagesize,:page_num => page_num,:scope=>scope}
11
+ end
9
12
 
10
- def bus
11
- @segments[:query]='公交站'
12
- self
13
- end
13
+ def search(query,region)
14
+ action_path = File.join(@service_path,__method__)
15
+ @http_segments = @segments.clone
16
+ @http_segments['query'] = query
17
+ @http_segments['region'] = region
18
+ uri = URI::HTTP.build(
19
+ :host => HOST,
20
+ :path => action_path,
21
+ :query => make_query(@http_segments)
22
+ )
14
23
 
15
- def bank
16
- @segments[:query]='银行'
17
- self
18
- end
24
+ self.class.get(uri)
19
25
 
20
- def cafe
21
- @segments[:query]='餐馆'
22
- self
23
- end
26
+ end
24
27
 
25
- def spot
26
- @segments[:query]='景点'
27
- self
28
- end
28
+ def detail
29
+ end
29
30
 
30
- def around(lat,lng)
31
- @segments[:location] = "#{lat},#{lng}"
32
- self
33
- end
31
+ def eventsearch
32
+ end
34
33
 
35
- def within(radius)
36
- @segments[:radius] = radius
37
- self
38
- end
34
+ def eventdetail
35
+ end
39
36
 
40
- #得到百度地图城市id
41
- def self.get_cityid(cityname)
42
- body = get "http://api.map.baidu.com/?qt=cur&wd=#{URI.encode(cityname)}&ie=utf-8&res=api"
43
- return body['content']['code']
44
- end
37
+ def bus
38
+ @segments[:query]='公交站'
39
+ self
40
+ end
45
41
 
46
- #从每条结果中解析x,y坐标
47
- def self.coordinate(poiname,cityid)
48
- # puts "http://api.map.baidu.com/geocoder?address=#{URI.encode(poiname)}&output=json&key=#{@key}&city=#{URI.encode(cityid)}"
49
- url = "http://api.map.baidu.com/geocoder?address=#{URI.encode(poiname)}&output=json&key=#{@key}&city=#{cityid}"
50
- result = get url
51
- location = result['result']
52
- return nil if location.nil? or location.empty?
53
- location = location['location']
54
- return location['lng'],location['lat'] if result['status'] == 'OK'
55
- end
42
+ def bank
43
+ @segments[:query]='银行'
44
+ self
45
+ end
46
+
47
+ def cafe
48
+ @segments[:query]='餐馆'
49
+ self
50
+ end
51
+
52
+ def spot
53
+ @segments[:query]='景点'
54
+ self
55
+ end
56
+
57
+ def around(lat,lng)
58
+ @segments[:location] = "#{lat},#{lng}"
59
+ self
60
+ end
56
61
 
57
- def info
58
- uri = URI::HTTP.build(
59
- :host => 'api.map.baidu.com',
60
- :query=> URI.encode(@segments.map{|k,v|"#{k}=#{v}"}.join('&')),
61
- :path => '/place/v2/search'
62
- )
63
- self.class.get(uri.to_s)
62
+ def within(radius)
63
+ @segments[:radius] = radius
64
+ self
65
+ end
66
+
67
+ #得到百度地图城市id
68
+ def self.get_cityid(cityname)
69
+ body = get "http://api.map.baidu.com/?qt=cur&wd=#{URI.encode(cityname)}&ie=utf-8&res=api"
70
+ return body['content']['code']
71
+ end
72
+
73
+ #从每条结果中解析x,y坐标
74
+ def self.coordinate(poiname,cityid)
75
+ # puts "http://api.map.baidu.com/geocoder?address=#{URI.encode(poiname)}&output=json&ak=#{@ak}&city=#{URI.encode(cityid)}"
76
+ url = "http://api.map.baidu.com/geocoder/v2?address=#{URI.encode(poiname)}&output=json&ak=#{@ak}&city=#{cityid}"
77
+ result = get url
78
+ location = result['result']
79
+ return nil if location.nil? or location.empty?
80
+ location = location['location']
81
+ return location['lng'],location['lat'] if result['status'] == 'OK'
82
+ end
83
+
84
+ def info
85
+ uri = URI::HTTP.build(
86
+ :host => 'api.map.baidu.com',
87
+ :query=> URI.encode(@segments.map{|k,v|"#{k}=#{v}"}.join('&')),
88
+ :path => '/place/v2/search'
89
+ )
90
+ self.class.get(uri.to_s)
91
+ end
92
+ private
93
+ def make_query(segments)
94
+ URI.encode(segments.map{|k,v|"#{k}=#{v}"}.join('&'))
95
+ end
64
96
  end
65
97
  end
66
98
  end
@@ -0,0 +1,47 @@
1
+ module Baidu
2
+ module Map
3
+ class Geocoder
4
+ include HTTParty
5
+ HOST = 'api.map.baidu.com'
6
+ PATH = '/geocoder/v2/'
7
+ def initialize(ak)
8
+ @ak = ak
9
+ end
10
+
11
+ def encode(address,city)
12
+ segments = {
13
+ 'ak'=>@ak,
14
+ 'address' => address,
15
+ 'city' => city,
16
+ 'output'=>'json'
17
+ }
18
+
19
+ uri = URI::HTTP.build(
20
+ :host => @host,
21
+ :path => @path
22
+ :query => make_query(segments)
23
+ ).to_s
24
+ self.class.get(uri)
25
+ end
26
+
27
+ def decodoe(lng,lat)
28
+ segments = {
29
+ 'ak'=>@ak,
30
+ 'location'=>"#{lng},#{lat}",
31
+ 'output'=>'json'
32
+ }
33
+ uri = URI::HTTP.build(
34
+ :host =>
35
+ :query=> make_query(segments)
36
+ :path => PATH
37
+ ).to_s
38
+ self.class.get(uri)
39
+ end
40
+
41
+ private
42
+ def make_query(segments)
43
+ URI.encode(segments.map{|k,v|"#{k}=#{v}"}.join('&')),
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,6 @@
1
+ module Baidu
2
+ module Map
3
+ class Request
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module Baidu
2
+ module Map
3
+ class Result
4
+ end
5
+ end
6
+ end
@@ -2,8 +2,25 @@ module Baidu
2
2
  class Response
3
3
  attr_accessor :header,:body,:rquota,:quota,:status,:desc,:oprs,:oprtime
4
4
  def initialize(response,name_response_sym)
5
+ name_response_sym =
6
+ case name_response_sym
7
+ when 'getAllCampaign'
8
+ 'GetAllCampaign'
9
+ when 'getCampaignByCampaignId'
10
+ 'GetCampaignByCampaignId'
11
+ when 'addCampaign'
12
+ 'AddCampaign'
13
+ when 'updateCampaign'
14
+ 'UpdateCampaign'
15
+ when 'deleteCampaign'
16
+ 'DeleteCampaign'
17
+ when 'getCampaignByCampaignId'
18
+ 'GetCampaignByCampaignId'
19
+ else
20
+ name_response_sym
21
+ end
5
22
  @header = response.header[:res_header]
6
- @body = response.body[name_response_sym]
23
+ @body = response.body[name_response_sym] if(response.body and response.body.has_key?name_response_sym)
7
24
  @rquota = @header[:rquota].to_i
8
25
  @quota = @header[:quota].to_i
9
26
  @status = @header[:status].to_i
@@ -1,5 +1,7 @@
1
- require "baidu/sem/enum"
1
+ require "baidu"
2
2
  require "baidu/sem/base"
3
+ require "baidu/sem/enum"
4
+ require "baidu/sem/rank"
3
5
  require "baidu/sem/report"
4
6
  require "baidu/sem/account"
5
7
  require "baidu/sem/adgroup"
@@ -0,0 +1,7 @@
1
+ module Baidu
2
+ module SEM
3
+ class Rank < Base
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module Baidu
2
+ module Rank
3
+ class RankService < Base
4
+ # include Baidu::Rank
5
+ end
6
+ end
7
+ end
@@ -1,3 +1,3 @@
1
1
  module Baidu
2
- VERSION = "2.0.4"
2
+ VERSION = "2.0.9"
3
3
  end
metadata CHANGED
@@ -1,83 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: baidu
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.4
4
+ version: 2.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - seoaqua
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-22 00:00:00.000000000 Z
11
+ date: 2014-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: httparty
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: awesome_print
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: savon
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: '3.0'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '3.0'
83
83
  description: Baidu Services Pack,including SEM, Map, Ranking and the others
@@ -87,16 +87,19 @@ executables: []
87
87
  extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
- - .gitignore
90
+ - ".gitignore"
91
91
  - Gemfile
92
92
  - LICENSE.txt
93
93
  - README.md
94
94
  - Rakefile
95
95
  - baidu.gemspec
96
+ - docs/BaiduSEMAPI_V3.pdf
96
97
  - lib/baidu.rb
97
98
  - lib/baidu/auth.rb
98
99
  - lib/baidu/map.rb
99
- - lib/baidu/rank.rb
100
+ - lib/baidu/map/geocoder.rb
101
+ - lib/baidu/map/request.rb
102
+ - lib/baidu/map/result.rb
100
103
  - lib/baidu/response.rb
101
104
  - lib/baidu/sem.rb
102
105
  - lib/baidu/sem/account.rb
@@ -109,6 +112,8 @@ files:
109
112
  - lib/baidu/sem/keyword.rb
110
113
  - lib/baidu/sem/kr.rb
111
114
  - lib/baidu/sem/new_creative.rb
115
+ - lib/baidu/sem/rank.rb
116
+ - lib/baidu/sem/rankservice.rb
112
117
  - lib/baidu/sem/report.rb
113
118
  - lib/baidu/sem/search.rb
114
119
  - lib/baidu/translate.rb
@@ -136,17 +141,17 @@ require_paths:
136
141
  - lib
137
142
  required_ruby_version: !ruby/object:Gem::Requirement
138
143
  requirements:
139
- - - '>='
144
+ - - ">="
140
145
  - !ruby/object:Gem::Version
141
146
  version: '0'
142
147
  required_rubygems_version: !ruby/object:Gem::Requirement
143
148
  requirements:
144
- - - '>='
149
+ - - ">="
145
150
  - !ruby/object:Gem::Version
146
151
  version: '0'
147
152
  requirements: []
148
153
  rubyforge_project:
149
- rubygems_version: 2.1.5
154
+ rubygems_version: 2.2.2
150
155
  signing_key:
151
156
  specification_version: 4
152
157
  summary: a gem summary
@@ -1,4 +0,0 @@
1
- module Baidu
2
- module Rank
3
- end
4
- end