Class: Bling::API::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/bling/api/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(url, params = {}, response_class) ⇒ Client

and a response_class used to parse the response



9
10
11
12
13
# File 'lib/bling/api/client.rb', line 9

def initialize(url, params={}, response_class)
  @uri = build_uri(url)
  @params = params
  @response_class = response_class
end

Instance Method Details

#deleteResponse



28
29
30
# File 'lib/bling/api/client.rb', line 28

def delete
  Response.new(delete_request, response_class)
end

#getResponse



16
17
18
19
20
# File 'lib/bling/api/client.rb', line 16

def get
  uri.query = URI.encode_www_form(get_params(params))
  request = Net::HTTP.get_response(uri)
  Response.new(request, response_class)
end

#postResponse



23
24
25
# File 'lib/bling/api/client.rb', line 23

def post
  Response.new(post_request, response_class)
end