Class: JustGiving::HttpClient

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/just_giving/http_client.rb

Instance Method Summary collapse

Constructor Details

#initialize(api_key, version) ⇒ HttpClient

Returns a new instance of HttpClient.



10
11
12
13
# File 'lib/just_giving/http_client.rb', line 10

def initialize(api_key, version)
  @api_key = api_key
  @version = version
end

Instance Method Details

#construct_uri(path) ⇒ Object



23
24
25
# File 'lib/just_giving/http_client.rb', line 23

def construct_uri(path)
  "/#{api_key}/#{version}#{path}"
end

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



15
16
17
# File 'lib/just_giving/http_client.rb', line 15

def get(path, params = {})
  self.class.get(construct_uri(path), :query => params).parsed_response
end

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



19
20
21
# File 'lib/just_giving/http_client.rb', line 19

def post(path, params = {})
  self.class.post(construct_uri(path), :query => params).parsed_response
end