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 84 85 |
# 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], log_asana_change_warnings: config[:log_asana_change_warnings], default_headers: config[:default_headers], &config[:faraday_configuration]) 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.
111 112 113 |
# File 'lib/asana/client.rb', line 111 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.
90 91 92 |
# File 'lib/asana/client.rb', line 90 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.
97 98 99 |
# File 'lib/asana/client.rb', line 97 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.
104 105 106 |
# File 'lib/asana/client.rb', line 104 def put(url, **args) @http_client.put(url, **args) end |