Class: DianPing::Client

Inherits:
Object
  • Object
show all
Includes:
API::Business
Defined in:
lib/dianping/client.rb

Instance Method Summary collapse

Methods included from API::Business

#find_businesses

Methods included from API::Utils

#send

Methods included from API::Auth

#generate_signature

Constructor Details

#initialize(options = {}) ⇒ DianPing::Client

Initializes a new Client object

Parameters:

  • options (Hash) (defaults to: {})


11
12
# File 'lib/dianping/client.rb', line 11

def initialize(options={})
end

Instance Method Details

#delete(path, params = {}) ⇒ Object

Perform an HTTP DELETE request



15
16
17
# File 'lib/dianping/client.rb', line 15

def delete(path, params={})
  request(:delete, path, params)
end

#get(path, params = {}) ⇒ Object

Perform an HTTP GET request



20
21
22
# File 'lib/dianping/client.rb', line 20

def get(path, params={})
  request(:get, path, params)
end

#post(path, params = {}) ⇒ Object

Perform an HTTP POST request



25
26
27
28
# File 'lib/dianping/client.rb', line 25

def post(path, params={})
  signature_params = params.values.any?{|value| value.respond_to?(:to_io)} ? {} : params
  request(:post, path, params, signature_params)
end

#put(path, params = {}) ⇒ Object

Perform an HTTP PUT request



31
32
33
# File 'lib/dianping/client.rb', line 31

def put(path, params={})
  request(:put, path, params)
end