Class: Apikit::Client
- Inherits:
-
Object
- Object
- Apikit::Client
- Defined in:
- lib/apikit/client.rb
Instance Attribute Summary collapse
-
#api_endpoint ⇒ Object
Returns the value of attribute api_endpoint.
-
#config ⇒ Object
Returns the value of attribute config.
Instance Method Summary collapse
- #delete(path, options = {}) ⇒ Object
-
#get(path, options = {}) ⇒ Object
options: query:.
-
#initialize(api_endpoint, config = Apikit.config) ⇒ Client
constructor
options:.
- #post(path, options = {}) ⇒ Object
- #put(path, options = {}) ⇒ Object
- #request(method, path, options = {}) ⇒ Object
Constructor Details
#initialize(api_endpoint, config = Apikit.config) ⇒ Client
options:
6 7 8 9 |
# File 'lib/apikit/client.rb', line 6 def initialize(api_endpoint, config = Apikit.config ) @api_endpoint = api_endpoint @config = config end |
Instance Attribute Details
#api_endpoint ⇒ Object
Returns the value of attribute api_endpoint.
3 4 5 |
# File 'lib/apikit/client.rb', line 3 def api_endpoint @api_endpoint end |
#config ⇒ Object
Returns the value of attribute config.
3 4 5 |
# File 'lib/apikit/client.rb', line 3 def config @config end |
Instance Method Details
#delete(path, options = {}) ⇒ Object
25 26 27 |
# File 'lib/apikit/client.rb', line 25 def delete(path, = {}) request :delete, path, end |
#get(path, options = {}) ⇒ Object
options:
query:
13 14 15 |
# File 'lib/apikit/client.rb', line 13 def get(path, = {}) request :get, path, end |
#post(path, options = {}) ⇒ Object
17 18 19 |
# File 'lib/apikit/client.rb', line 17 def post(path, = {}) request :post, path, end |
#put(path, options = {}) ⇒ Object
21 22 23 |
# File 'lib/apikit/client.rb', line 21 def put(path, = {}) request :put, path, end |
#request(method, path, options = {}) ⇒ Object
29 30 31 32 |
# File 'lib/apikit/client.rb', line 29 def request(method, path, = {}) response = agent.call(method, URI::Parser.new.escape(path.to_s), nil, ) response.data end |