Class: Posthubify::InboxAnalyticsResource
- Inherits:
-
Object
- Object
- Posthubify::InboxAnalyticsResource
- Defined in:
- lib/posthubify/resources/analytics.rb
Overview
Inbox analytics (Node sdk .inboxAnalytics) — dm-based volume/heatmap/response-time/source/leaderboard. from_date is required (YYYY-MM-DD); common filters to_date/platform/account_id/source.
Instance Method Summary collapse
-
#conversation(conversation_id, from_date:, to_date: nil, platform: nil, account_id: nil, source: nil) ⇒ Object
Detail for a single conversation’s analytics.
-
#conversations(from_date:, to_date: nil, platform: nil, account_id: nil, source: nil, limit: nil, cursor: nil) ⇒ Object
Per-conversation statistics — paginated (Paged envelope; @http.req returns the raw body).
-
#heatmap(from_date:, to_date: nil, platform: nil, account_id: nil, source: nil) ⇒ Object
Activity heatmap (dow 1=Mon..7=Sun, hour 0-23 UTC; only non-empty buckets).
-
#initialize(http) ⇒ InboxAnalyticsResource
constructor
A new instance of InboxAnalyticsResource.
-
#response_time(from_date:, to_date: nil, platform: nil, account_id: nil, source: nil) ⇒ Object
Response time metrics.
-
#source_breakdown(from_date:, to_date: nil, platform: nil, account_id: nil, source: nil) ⇒ Object
Source breakdown.
-
#top_accounts(from_date:, to_date: nil, platform: nil, account_id: nil, source: nil) ⇒ Object
Leaderboard of the most active accounts.
-
#volume(from_date:, to_date: nil, platform: nil, account_id: nil, source: nil) ⇒ Object
DM volume (summary + daily + platform breakdown).
Constructor Details
#initialize(http) ⇒ InboxAnalyticsResource
Returns a new instance of InboxAnalyticsResource.
107 108 109 |
# File 'lib/posthubify/resources/analytics.rb', line 107 def initialize(http) @http = http end |
Instance Method Details
#conversation(conversation_id, from_date:, to_date: nil, platform: nil, account_id: nil, source: nil) ⇒ Object
Detail for a single conversation’s analytics.
151 152 153 154 155 |
# File 'lib/posthubify/resources/analytics.rb', line 151 def conversation(conversation_id, from_date:, to_date: nil, platform: nil, account_id: nil, source: nil) @http.data('GET', "/analytics/inbox/conversations/#{conversation_id}", query: inbox_query(from_date, to_date, platform, account_id, source)) end |
#conversations(from_date:, to_date: nil, platform: nil, account_id: nil, source: nil, limit: nil, cursor: nil) ⇒ Object
Per-conversation statistics — paginated (Paged envelope; @http.req returns the raw body).
142 143 144 145 146 147 148 |
# File 'lib/posthubify/resources/analytics.rb', line 142 def conversations(from_date:, to_date: nil, platform: nil, account_id: nil, source: nil, limit: nil, cursor: nil) query = inbox_query(from_date, to_date, platform, account_id, source) query['limit'] = limit query['cursor'] = cursor @http.req('GET', '/analytics/inbox/conversations', query: query) end |
#heatmap(from_date:, to_date: nil, platform: nil, account_id: nil, source: nil) ⇒ Object
Activity heatmap (dow 1=Mon..7=Sun, hour 0-23 UTC; only non-empty buckets).
118 119 120 121 |
# File 'lib/posthubify/resources/analytics.rb', line 118 def heatmap(from_date:, to_date: nil, platform: nil, account_id: nil, source: nil) @http.data('GET', '/analytics/inbox/heatmap', query: inbox_query(from_date, to_date, platform, account_id, source)) end |
#response_time(from_date:, to_date: nil, platform: nil, account_id: nil, source: nil) ⇒ Object
Response time metrics.
124 125 126 127 |
# File 'lib/posthubify/resources/analytics.rb', line 124 def response_time(from_date:, to_date: nil, platform: nil, account_id: nil, source: nil) @http.data('GET', '/analytics/inbox/response-time', query: inbox_query(from_date, to_date, platform, account_id, source)) end |
#source_breakdown(from_date:, to_date: nil, platform: nil, account_id: nil, source: nil) ⇒ Object
Source breakdown.
130 131 132 133 |
# File 'lib/posthubify/resources/analytics.rb', line 130 def source_breakdown(from_date:, to_date: nil, platform: nil, account_id: nil, source: nil) @http.data('GET', '/analytics/inbox/source-breakdown', query: inbox_query(from_date, to_date, platform, account_id, source)) end |
#top_accounts(from_date:, to_date: nil, platform: nil, account_id: nil, source: nil) ⇒ Object
Leaderboard of the most active accounts.
136 137 138 139 |
# File 'lib/posthubify/resources/analytics.rb', line 136 def top_accounts(from_date:, to_date: nil, platform: nil, account_id: nil, source: nil) @http.data('GET', '/analytics/inbox/top-accounts', query: inbox_query(from_date, to_date, platform, account_id, source)) end |
#volume(from_date:, to_date: nil, platform: nil, account_id: nil, source: nil) ⇒ Object
DM volume (summary + daily + platform breakdown).
112 113 114 115 |
# File 'lib/posthubify/resources/analytics.rb', line 112 def volume(from_date:, to_date: nil, platform: nil, account_id: nil, source: nil) @http.data('GET', '/analytics/inbox/volume', query: inbox_query(from_date, to_date, platform, account_id, source)) end |