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.
- #monitors ⇒ Object
- #patch(path, body: nil) ⇒ Object
- #post(path, body: nil, params: {}) ⇒ Object
- #put(path, body: nil) ⇒ Object
- #signup ⇒ Object
-
#tasks ⇒ Object
Deprecated: use #monitors.
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
31 32 33 |
# File 'lib/meerkat/client.rb', line 31 def api_keys @api_keys ||= Resources::ApiKeys.new(self) end |
#delete(path, params: {}) ⇒ Object
51 52 53 |
# File 'lib/meerkat/client.rb', line 51 def delete(path, params: {}) request(:delete, path, params: params) end |
#get(path, params: {}) ⇒ Object
35 36 37 |
# File 'lib/meerkat/client.rb', line 35 def get(path, params: {}) request(:get, path, params: params) end |
#monitors ⇒ Object
22 23 24 |
# File 'lib/meerkat/client.rb', line 22 def monitors @monitors ||= Resources::Monitors.new(self) end |
#patch(path, body: nil) ⇒ Object
43 44 45 |
# File 'lib/meerkat/client.rb', line 43 def patch(path, body: nil) request(:patch, path, body: body) end |
#post(path, body: nil, params: {}) ⇒ Object
39 40 41 |
# File 'lib/meerkat/client.rb', line 39 def post(path, body: nil, params: {}) request(:post, path, body: body, params: params) end |
#put(path, body: nil) ⇒ Object
47 48 49 |
# File 'lib/meerkat/client.rb', line 47 def put(path, body: nil) request(:put, path, body: body) end |
#signup ⇒ Object
18 19 20 |
# File 'lib/meerkat/client.rb', line 18 def signup @signup ||= Resources::Signup.new(self) end |
#tasks ⇒ Object
Deprecated: use #monitors. Kept for older examples.
27 28 29 |
# File 'lib/meerkat/client.rb', line 27 def tasks monitors end |