Class: Trello::Client
- Inherits:
-
Object
- Object
- Trello::Client
- Defined in:
- lib/trello/client.rb
Constant Summary collapse
- BASE_URL =
"https://api.trello.com"
Instance Method Summary collapse
- #delete(path) ⇒ Object
- #get(path) ⇒ Object
-
#initialize(key:, token:) ⇒ Client
constructor
A new instance of Client.
- #post(path, body = {}) ⇒ Object
Constructor Details
#initialize(key:, token:) ⇒ Client
Returns a new instance of Client.
7 8 9 10 11 12 |
# File 'lib/trello/client.rb', line 7 def initialize(key:, token:) raise unless key && token @key = key @token = token @http_client = NetHttpClient.new(URI.parse(BASE_URL)) end |
Instance Method Details
#delete(path) ⇒ Object
22 23 24 |
# File 'lib/trello/client.rb', line 22 def delete(path) @http_client.perform(:delete, with_key_and_token(path)) end |
#get(path) ⇒ Object
14 15 16 |
# File 'lib/trello/client.rb', line 14 def get(path) @http_client.perform(:get, with_key_and_token(path)) end |
#post(path, body = {}) ⇒ Object
18 19 20 |
# File 'lib/trello/client.rb', line 18 def post(path, body = {}) @http_client.perform(:post, with_key_and_token(path), body.to_json) end |