Class: Parse::HttpClient

Inherits:
Object
  • Object
show all
Defined in:
lib/parse/http_client.rb

Direct Known Subclasses

NetHttpClient, PatronHttpClient

Defined Under Namespace

Classes: TimeoutError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(base_url = nil, headers = {}) ⇒ HttpClient

Returns a new instance of HttpClient.



7
8
9
10
# File 'lib/parse/http_client.rb', line 7

def initialize(base_url=nil, headers = {})
  @base_url = base_url
  @headers = headers
end

Instance Attribute Details

#base_urlObject

Returns the value of attribute base_url.



5
6
7
# File 'lib/parse/http_client.rb', line 5

def base_url
  @base_url
end

#headersObject

Returns the value of attribute headers.



5
6
7
# File 'lib/parse/http_client.rb', line 5

def headers
  @headers
end

Instance Method Details

#build_query(hash) ⇒ Object



12
13
14
# File 'lib/parse/http_client.rb', line 12

def build_query(hash)
  hash.to_a.map{|k, v| "#{k}=#{v}"}.join('&')
end

#request(method, uri, headers, options) ⇒ Object



16
17
18
# File 'lib/parse/http_client.rb', line 16

def request(method, uri, headers, options)
  NotImplementedError.new("Subclass responsibility")
end