Class: JustGiving::HttpClient
- Inherits:
-
Object
- Object
- JustGiving::HttpClient
- Includes:
- HTTParty
- Defined in:
- lib/just_giving/http_client.rb
Instance Method Summary collapse
- #construct_uri(path) ⇒ Object
- #get(path, params = {}) ⇒ Object
-
#initialize(api_key, version) ⇒ HttpClient
constructor
A new instance of HttpClient.
- #post(path, params = {}) ⇒ Object
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 |