Class: Malartu::Connection
- Inherits:
-
MalartuObject
- Object
- MalartuObject
- Malartu::Connection
- Defined in:
- lib/malartu/connection.rb
Overview
A connection is what ties together a company and a portfolios
Instance Attribute Summary
Attributes inherited from MalartuObject
Class Method Summary collapse
- .list ⇒ Object
- .metrics(id, starting: nil, ending: DateTime.now.to_s, grain: nil, timezone: "UTC", uids: []) ⇒ Object
Methods inherited from MalartuObject
Constructor Details
This class inherits a constructor from Malartu::MalartuObject
Class Method Details
.list ⇒ Object
4 5 6 7 8 9 |
# File 'lib/malartu/connection.rb', line 4 def self.list res = Malartu.request('get', '/kpi/connections') res['connections'].map do |connection| Malartu::Schedule.new(connection) end end |
.metrics(id, starting: nil, ending: DateTime.now.to_s, grain: nil, timezone: "UTC", uids: []) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/malartu/connection.rb', line 11 def self.metrics(id, starting: nil, ending: DateTime.now.to_s, grain: nil, timezone: "UTC", uids: []) uids = uids.join(',') params = { start_date: starting, end_date: ending, grain: grain, timezone: timezone, uids: uids }.select { |_, value| !value.nil? } Malartu.request('get', "/kpi/connections/#{1}/metrics", params) end |