Class: Asana::Client
- Inherits:
-
Object
- Object
- Asana::Client
- Defined in:
- lib/asana/client.rb,
lib/asana/client/configuration.rb
Overview
A client to interact with the Asana API. It exposes all the available resources of the Asana API in idiomatic Ruby.
Defined Under Namespace
Classes: Configuration, ResourceProxy
Instance Method Summary collapse
-
#delete(url, *args) ⇒ Object
Performs a DELETE request against an arbitrary Asana URL.
-
#get(url, *args) ⇒ Object
Performs a GET request against an arbitrary Asana URL.
-
#initialize { ... } ⇒ Client
constructor
Initializes a new client.
-
#post(url, *args) ⇒ Object
Performs a POST request against an arbitrary Asana URL.
-
#put(url, *args) ⇒ Object
Performs a PUT request against an arbitrary Asana URL.
Constructor Details
#initialize { ... } ⇒ Client
Initializes a new client.
75 76 77 78 79 80 81 82 83 |
# File 'lib/asana/client.rb', line 75 def initialize config = Configuration.new.tap { |c| yield c }.to_h @http_client = HttpClient.new(authentication: config.fetch(:authentication), adapter: config[:faraday_adapter], user_agent: config[:user_agent], debug_mode: config[:debug_mode], &config[:faraday_config]) end |
Instance Method Details
#delete(url, *args) ⇒ Object
Performs a DELETE request against an arbitrary Asana URL. Allows for the user to interact with the API in ways that haven’t been reflected/foreseen in this library.
109 110 111 |
# File 'lib/asana/client.rb', line 109 def delete(url, *args) @http_client.delete(url, *args) end |
#get(url, *args) ⇒ Object
Performs a GET request against an arbitrary Asana URL. Allows for the user to interact with the API in ways that haven’t been reflected/foreseen in this library.
88 89 90 |
# File 'lib/asana/client.rb', line 88 def get(url, *args) @http_client.get(url, *args) end |
#post(url, *args) ⇒ Object
Performs a POST request against an arbitrary Asana URL. Allows for the user to interact with the API in ways that haven’t been reflected/foreseen in this library.
95 96 97 |
# File 'lib/asana/client.rb', line 95 def post(url, *args) @http_client.post(url, *args) end |
#put(url, *args) ⇒ Object
Performs a PUT request against an arbitrary Asana URL. Allows for the user to interact with the API in ways that haven’t been reflected/foreseen in this library.
102 103 104 |
# File 'lib/asana/client.rb', line 102 def put(url, *args) @http_client.put(url, *args) end |