Code Monkey home page Code Monkey logo

baidu's Introduction

Baidu

Baidu SEM Services Baidu Ranking Services Baidu Map Services

Installation

Add this line to your application's Gemfile:

gem 'baidu'

And then execute:

$ bundle

Or install it yourself as:

$ gem install baidu

Knowledge

camel命名法,用于request数据格式 snake命名法,用于response数据格式

Rspec

先修改spec/spec_helper.rb

BAIDU_MAP_KEY = ''
$username = ''
$password = ''
$token = ''

Usage

SEM

require 'baidu'

$auth = Baidu::Auth.new
$auth.username = 'username'
$auth.password = 'password'
$auth.token = 'token'

ss = Baidu::SEM::SearchService.new
res = ss.getKeywordBySearch({:searchWord=>'word',:searchType=>0})
res = ss.getKeywordBySearch({:searchWord=>'word',:searchType=>0},true) #debug=true

MAP

#返回码 定义 英文返回描述
#0 正常 ok
#2 请求参数非法 Parameter Invalid
#3 权限校验失败 Verify Failure
#4 配额校验失败 Quota Failure
#5 ak不存在或者非法 AK Failure
#2xx 无权限
#3xx 配额错误
puts map.get_xy_by_poiname('滨海公园','上海')
map = Baidumap.new('key')
require 'awesome_print'
lat = 40.3377039331399
lng = 116.647588831718
ap map.bus.around(lat,lng).info
puts map.get(39.911031821584,116.44931548023).for(1000).bus
puts map.geo('22.53','113.38')
Baidumap.get_baike('北京站')
Baidumap.get_cityid('北京') #=>131

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

baidu's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.