telerivet 1.4.5 → 1.6.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -98,6 +98,86 @@ class Organization < Entity
98
98
  return @api.do_request("GET", get_base_api_path() + "/usage/#{usage_type}")
99
99
  end
100
100
 
101
+ #
102
+ # Retrieves statistics about messages sent or received via Telerivet. This endpoint returns
103
+ # historical data that is computed shortly after midnight each day in the project's time zone,
104
+ # and does not contain message statistics for the current day.
105
+ #
106
+ # Arguments:
107
+ # - options (Hash)
108
+ # * Required
109
+ #
110
+ # - start_date (string)
111
+ # * Start date of message statistics, in YYYY-MM-DD format
112
+ # * Required
113
+ #
114
+ # - end_date (string)
115
+ # * End date of message statistics (inclusive), in YYYY-MM-DD format
116
+ # * Required
117
+ #
118
+ # - rollup (string)
119
+ # * Date interval to group by
120
+ # * Allowed values: day, week, month, year, all
121
+ # * Default: day
122
+ #
123
+ # - properties (string)
124
+ # * Comma separated list of properties to group by
125
+ # * Allowed values: org_id, org_name, org_industry, project_id, project_name, user_id,
126
+ # user_email, user_name, phone_id, phone_name, phone_type, direction, source, status,
127
+ # network_code, network_name, message_type, service_id, service_name, simulated, link
128
+ #
129
+ # - metrics (string)
130
+ # * Comma separated list of metrics to return (summed for each distinct value of the
131
+ # requested properties)
132
+ # * Allowed values: count, num_parts, duration, price
133
+ # * Required
134
+ #
135
+ # - currency (string)
136
+ # * Three-letter ISO 4217 currency code used when returning the 'price' field. If the
137
+ # original price was in a different currency, it will be converted to the requested
138
+ # currency using the approximate current exchange rate.
139
+ # * Default: USD
140
+ #
141
+ # - filters (Hash)
142
+ # * Key-value pairs of properties and corresponding values; the returned statistics
143
+ # will only include messages where the property matches the provided value. Only the
144
+ # following properties are supported for filters: `user_id`, `phone_id`, `direction`,
145
+ # `source`, `status`, `service_id`, `simulated`, `message_type`, `network_code`
146
+ #
147
+ # Returns:
148
+ # (associative array)
149
+ # - intervals (array)
150
+ # * List of objects representing each date interval containing at least one message
151
+ # matching the filters.
152
+ # Each object has the following properties:
153
+ #
154
+ # <table>
155
+ # <tr><td> start_time </td> <td> The UNIX timestamp of the start
156
+ # of the interval (int) </td></tr>
157
+ # <tr><td> end_time </td> <td> The UNIX timestamp of the end of
158
+ # the interval, exclusive (int) </td></tr>
159
+ # <tr><td> start_date </td> <td> The date of the start of the
160
+ # interval in YYYY-MM-DD format (string) </td></tr>
161
+ # <tr><td> end_date </td> <td> The date of the end of the
162
+ # interval in YYYY-MM-DD format, inclusive (string) </td></tr>
163
+ # <tr><td> groups </td> <td> Array of groups for each
164
+ # combination of requested property values matching the filters (array)
165
+ # <br /><br />
166
+ # Each object has the following properties:
167
+ # <table>
168
+ # <tr><td> properties </td> <td> An object of key/value
169
+ # pairs for each distinct value of the requested properties (object) </td></tr>
170
+ # <tr><td> metrics </td> <td> An object of key/value pairs
171
+ # for each requested metric (object) </td></tr>
172
+ # </table>
173
+ # </td></tr>
174
+ # </table>
175
+ #
176
+ def get_message_stats(options)
177
+ data = @api.do_request("GET", get_base_api_path() + "/message_stats", options)
178
+ return data
179
+ end
180
+
101
181
  #
102
182
  # Queries projects in this organization.
103
183
  #
@@ -115,7 +115,8 @@ class Phone < Entity
115
115
  #
116
116
  # - source
117
117
  # * Filter messages by source
118
- # * Allowed values: phone, provider, web, api, service, webhook, scheduled
118
+ # * Allowed values: phone, provider, web, api, service, webhook, scheduled,
119
+ # integration
119
120
  #
120
121
  # - starred (bool)
121
122
  # * Filter messages by starred/unstarred
@@ -123,7 +124,7 @@ class Phone < Entity
123
124
  # - status
124
125
  # * Filter messages by status
125
126
  # * Allowed values: ignored, processing, received, sent, queued, failed,
126
- # failed_queued, cancelled, delivered, not_delivered
127
+ # failed_queued, cancelled, delivered, not_delivered, read
127
128
  #
128
129
  # - time_created[min] (UNIX timestamp)
129
130
  # * Filter messages created on or after a particular time
@@ -133,18 +134,26 @@ class Phone < Entity
133
134
  #
134
135
  # - external_id
135
136
  # * Filter messages by ID from an external provider
137
+ # * Allowed modifiers: external_id[ne], external_id[exists]
136
138
  #
137
139
  # - contact_id
138
140
  # * ID of the contact who sent/received the message
141
+ # * Allowed modifiers: contact_id[ne], contact_id[exists]
139
142
  #
140
143
  # - phone_id
141
144
  # * ID of the phone (basic route) that sent/received the message
142
145
  #
143
146
  # - broadcast_id
144
147
  # * ID of the broadcast containing the message
148
+ # * Allowed modifiers: broadcast_id[ne], broadcast_id[exists]
145
149
  #
146
150
  # - scheduled_id
147
151
  # * ID of the scheduled message that created this message
152
+ # * Allowed modifiers: scheduled_id[ne], scheduled_id[exists]
153
+ #
154
+ # - group_id
155
+ # * Filter messages sent or received by contacts in a particular group. The group must
156
+ # be a normal group, not a dynamic group.
148
157
  #
149
158
  # - sort
150
159
  # * Sort the results based on a field