Class: Meerkat::Client
- Inherits:
-
Object
- Object
- Meerkat::Client
- Defined in:
- lib/meerkat/client.rb
Constant Summary collapse
- DEFAULT_BASE_URL =
"https://cloud.meerkatagents.com/api/v1"- USER_AGENT =
"meerkat-agents/#{Meerkat::VERSION}"
Instance Method Summary collapse
- #api_keys ⇒ Object
- #delete(path, params: {}) ⇒ Object
- #get(path, params: {}) ⇒ Object
-
#initialize(api_key: nil, base_url: DEFAULT_BASE_URL, timeout: 30, faraday: nil) ⇒ Client
constructor
A new instance of Client.
- #patch(path, body: nil) ⇒ Object
- #post(path, body: nil, params: {}) ⇒ Object
- #put(path, body: nil) ⇒ Object
- #signup ⇒ Object
- #tasks ⇒ Object
Constructor Details
#initialize(api_key: nil, base_url: DEFAULT_BASE_URL, timeout: 30, faraday: nil) ⇒ Client
Returns a new instance of Client.
11 12 13 14 15 16 |
# File 'lib/meerkat/client.rb', line 11 def initialize(api_key: nil, base_url: DEFAULT_BASE_URL, timeout: 30, faraday: nil) @api_key = api_key @base_url = normalize_base_url(base_url) @timeout = timeout @connection = faraday || build_connection end |
Instance Method Details
#api_keys ⇒ Object
26 27 28 |
# File 'lib/meerkat/client.rb', line 26 def api_keys @api_keys ||= Resources::ApiKeys.new(self) end |
#delete(path, params: {}) ⇒ Object
46 47 48 |
# File 'lib/meerkat/client.rb', line 46 def delete(path, params: {}) request(:delete, path, params: params) end |
#get(path, params: {}) ⇒ Object
30 31 32 |
# File 'lib/meerkat/client.rb', line 30 def get(path, params: {}) request(:get, path, params: params) end |
#patch(path, body: nil) ⇒ Object
38 39 40 |
# File 'lib/meerkat/client.rb', line 38 def patch(path, body: nil) request(:patch, path, body: body) end |
#post(path, body: nil, params: {}) ⇒ Object
34 35 36 |
# File 'lib/meerkat/client.rb', line 34 def post(path, body: nil, params: {}) request(:post, path, body: body, params: params) end |
#put(path, body: nil) ⇒ Object
42 43 44 |
# File 'lib/meerkat/client.rb', line 42 def put(path, body: nil) request(:put, path, body: body) end |