telerivet 1.5.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/telerivet/airtimetransaction.rb +16 -0
- data/lib/telerivet/apicursor.rb +26 -22
- data/lib/telerivet/broadcast.rb +15 -4
- data/lib/telerivet/contact.rb +20 -10
- data/lib/telerivet/datatable.rb +15 -4
- data/lib/telerivet/group.rb +14 -14
- data/lib/telerivet/label.rb +10 -2
- data/lib/telerivet/message.rb +76 -34
- data/lib/telerivet/organization.rb +124 -2
- data/lib/telerivet/phone.rb +19 -9
- data/lib/telerivet/project.rb +930 -112
- data/lib/telerivet/relativescheduledmessage.rb +361 -0
- data/lib/telerivet/route.rb +1 -1
- data/lib/telerivet/scheduledmessage.rb +112 -22
- data/lib/telerivet/service.rb +140 -32
- data/lib/telerivet.rb +1 -1
- metadata +3 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 2276ff47e23f0670121a7295c0cf3d860740ebb0c1980de13e15ae2f25c2659d
         | 
| 4 | 
            +
              data.tar.gz: 55db2507c8bcfa9f8ed0c3102f830dea689fd57ef57d0a00f1b488eebf46f4b5
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: cdd68937b393e61a1ec76e536b0abfcf30e3bb16127b2ea6a37f221013c8ee9d43aa99f5bf758eeb70d04c0366ffcfe1a2e4af576d0620507412b92ac8ceeab7
         | 
| 7 | 
            +
              data.tar.gz: 50cf5362c2926a104d8e1d6cd15ee5473589cdf31e78e516f9e6ad1af335baec040de5b5cf8598dc8e95008e08fe9775a448da465fffc708030b8e217d86e52a
         | 
| @@ -28,6 +28,14 @@ module Telerivet | |
| 28 28 | 
             
            #       * Country code
         | 
| 29 29 | 
             
            #       * Read-only
         | 
| 30 30 | 
             
            #   
         | 
| 31 | 
            +
            #   - time_created (UNIX timestamp)
         | 
| 32 | 
            +
            #       * The time that the airtime transaction was created on Telerivet's servers
         | 
| 33 | 
            +
            #       * Read-only
         | 
| 34 | 
            +
            #   
         | 
| 35 | 
            +
            #   - transaction_time (UNIX timestamp)
         | 
| 36 | 
            +
            #       * The time that the airtime transaction was sent, or null if it has not been sent
         | 
| 37 | 
            +
            #       * Read-only
         | 
| 38 | 
            +
            #   
         | 
| 31 39 | 
             
            #   - status
         | 
| 32 40 | 
             
            #       * Current status of airtime transaction (`successful`, `failed`, `cancelled`,
         | 
| 33 41 | 
             
            #           `queued`, `pending_approval`, or `pending_payment`)
         | 
| @@ -90,6 +98,14 @@ class AirtimeTransaction < Entity | |
| 90 98 | 
             
                    get('country')
         | 
| 91 99 | 
             
                end
         | 
| 92 100 |  | 
| 101 | 
            +
                def time_created
         | 
| 102 | 
            +
                    get('time_created')
         | 
| 103 | 
            +
                end
         | 
| 104 | 
            +
             | 
| 105 | 
            +
                def transaction_time
         | 
| 106 | 
            +
                    get('transaction_time')
         | 
| 107 | 
            +
                end
         | 
| 108 | 
            +
             | 
| 93 109 | 
             
                def status
         | 
| 94 110 | 
             
                    get('status')
         | 
| 95 111 | 
             
                end
         | 
    
        data/lib/telerivet/apicursor.rb
    CHANGED
    
    | @@ -13,16 +13,16 @@ class APICursor | |
| 13 13 |  | 
| 14 14 | 
             
                def initialize(api, item_cls, path, params = nil)
         | 
| 15 15 | 
             
                    params ||= {}
         | 
| 16 | 
            -
             | 
| 16 | 
            +
             | 
| 17 17 | 
             
                    if params.has_key?('count')
         | 
| 18 18 | 
             
                        raise Exception, "Cannot construct APICursor with 'count' parameter. Call the count() method instead."
         | 
| 19 19 | 
             
                    end
         | 
| 20 | 
            -
             | 
| 20 | 
            +
             | 
| 21 21 | 
             
                    @api = api
         | 
| 22 22 | 
             
                    @item_cls = item_cls
         | 
| 23 23 | 
             
                    @path = path
         | 
| 24 24 | 
             
                    @params = params
         | 
| 25 | 
            -
             | 
| 25 | 
            +
             | 
| 26 26 | 
             
                    @count = -1
         | 
| 27 27 | 
             
                    @pos = nil
         | 
| 28 28 | 
             
                    @data = nil
         | 
| @@ -31,15 +31,15 @@ class APICursor | |
| 31 31 | 
             
                    @limit = nil
         | 
| 32 32 | 
             
                    @offset = 0
         | 
| 33 33 | 
             
                end
         | 
| 34 | 
            -
             | 
| 34 | 
            +
             | 
| 35 35 | 
             
                def each()
         | 
| 36 36 | 
             
                    loop do
         | 
| 37 37 | 
             
                        item = self.next()
         | 
| 38 | 
            -
                        return if item == nil | 
| 38 | 
            +
                        return if item == nil
         | 
| 39 39 | 
             
                        yield item
         | 
| 40 40 | 
             
                    end
         | 
| 41 41 | 
             
                end
         | 
| 42 | 
            -
             | 
| 42 | 
            +
             | 
| 43 43 | 
             
                #
         | 
| 44 44 | 
             
                # Limits the maximum number of entities fetched by this query.
         | 
| 45 45 | 
             
                # 
         | 
| @@ -60,7 +60,7 @@ class APICursor | |
| 60 60 | 
             
                    @limit = _limit
         | 
| 61 61 | 
             
                    self
         | 
| 62 62 | 
             
                end
         | 
| 63 | 
            -
             | 
| 63 | 
            +
             | 
| 64 64 | 
             
                #
         | 
| 65 65 | 
             
                # Returns the total count of entities matching the current query, without actually fetching
         | 
| 66 66 | 
             
                # the entities themselves.
         | 
| @@ -76,13 +76,13 @@ class APICursor | |
| 76 76 | 
             
                    if @count == -1
         | 
| 77 77 | 
             
                        params = @params.clone
         | 
| 78 78 | 
             
                        params['count'] = 1
         | 
| 79 | 
            -
             | 
| 79 | 
            +
             | 
| 80 80 | 
             
                        res = @api.do_request("GET", @path, params)
         | 
| 81 81 | 
             
                        @count = res['count'].to_i
         | 
| 82 82 | 
             
                    end
         | 
| 83 83 | 
             
                    @count
         | 
| 84 84 | 
             
                end
         | 
| 85 | 
            -
             | 
| 85 | 
            +
             | 
| 86 86 | 
             
                def all()
         | 
| 87 87 | 
             
                    to_a
         | 
| 88 88 | 
             
                end
         | 
| @@ -97,37 +97,41 @@ class APICursor | |
| 97 97 | 
             
                    return false if @limit != nil && @offset >= @limit
         | 
| 98 98 |  | 
| 99 99 | 
             
                    load_next_page() if @data == nil
         | 
| 100 | 
            -
             | 
| 100 | 
            +
             | 
| 101 101 | 
             
                    return true if @pos < @data.length
         | 
| 102 | 
            -
             | 
| 102 | 
            +
             | 
| 103 103 | 
             
                    return false if !@truncated
         | 
| 104 | 
            -
             | 
| 104 | 
            +
             | 
| 105 105 | 
             
                    load_next_page()
         | 
| 106 | 
            -
             | 
| 106 | 
            +
             | 
| 107 107 | 
             
                    @pos < @data.length
         | 
| 108 108 | 
             
                end
         | 
| 109 | 
            -
             | 
| 109 | 
            +
             | 
| 110 110 | 
             
                #
         | 
| 111 111 | 
             
                # Returns the next entity in the result set.
         | 
| 112 112 | 
             
                # 
         | 
| 113 113 | 
             
                # Returns:
         | 
| 114 114 | 
             
                #     Telerivet::Entity
         | 
| 115 115 | 
             
                #
         | 
| 116 | 
            -
                def next() | 
| 116 | 
            +
                def next()
         | 
| 117 117 | 
             
                    if @limit != nil && @offset >= @limit
         | 
| 118 118 | 
             
                        return nil
         | 
| 119 119 | 
             
                    end
         | 
| 120 | 
            -
             | 
| 120 | 
            +
             | 
| 121 121 | 
             
                    if @data == nil || (@pos >= @data.length && @truncated)
         | 
| 122 122 | 
             
                        load_next_page()
         | 
| 123 123 | 
             
                    end
         | 
| 124 | 
            -
             | 
| 124 | 
            +
             | 
| 125 125 | 
             
                    if @pos < @data.length
         | 
| 126 126 | 
             
                        item_data = @data[@pos]
         | 
| 127 127 | 
             
                        @pos += 1
         | 
| 128 128 | 
             
                        @offset += 1
         | 
| 129 129 | 
             
                        cls = @item_cls
         | 
| 130 | 
            -
                         | 
| 130 | 
            +
                        if cls
         | 
| 131 | 
            +
                            return cls.new(@api, item_data, true)
         | 
| 132 | 
            +
                        else
         | 
| 133 | 
            +
                            return item_data
         | 
| 134 | 
            +
                        end
         | 
| 131 135 | 
             
                    else
         | 
| 132 136 | 
             
                        return nil
         | 
| 133 137 | 
             
                    end
         | 
| @@ -135,17 +139,17 @@ class APICursor | |
| 135 139 |  | 
| 136 140 | 
             
                def load_next_page()
         | 
| 137 141 | 
             
                    request_params = @params.clone
         | 
| 138 | 
            -
             | 
| 142 | 
            +
             | 
| 139 143 | 
             
                    if @next_marker != nil
         | 
| 140 144 | 
             
                        request_params['marker'] = @next_marker
         | 
| 141 145 | 
             
                    end
         | 
| 142 | 
            -
             | 
| 146 | 
            +
             | 
| 143 147 | 
             
                    if @limit != nil && !request_params.has_key?("page_size")
         | 
| 144 148 | 
             
                        request_params['page_size'] = [@limit, 200].min
         | 
| 145 149 | 
             
                    end
         | 
| 146 | 
            -
             | 
| 150 | 
            +
             | 
| 147 151 | 
             
                    response = @api.do_request("GET", @path, request_params)
         | 
| 148 | 
            -
             | 
| 152 | 
            +
             | 
| 149 153 | 
             
                    @data = response['data']
         | 
| 150 154 | 
             
                    @truncated = response['truncated']
         | 
| 151 155 | 
             
                    @next_marker = response['next_marker']
         | 
    
        data/lib/telerivet/broadcast.rb
    CHANGED
    
    | @@ -75,7 +75,7 @@ module Telerivet | |
| 75 75 | 
             
            #   
         | 
| 76 76 | 
             
            #   - message_type
         | 
| 77 77 | 
             
            #       * Type of message sent from this broadcast
         | 
| 78 | 
            -
            #       * Allowed values: sms, mms, ussd, call, service
         | 
| 78 | 
            +
            #       * Allowed values: sms, mms, ussd, ussd_session, call, chat, service
         | 
| 79 79 | 
             
            #       * Read-only
         | 
| 80 80 | 
             
            #   
         | 
| 81 81 | 
             
            #   - content (string)
         | 
| @@ -97,7 +97,7 @@ module Telerivet | |
| 97 97 | 
             
            #       * Allowed values: female, male
         | 
| 98 98 | 
             
            #       * Read-only
         | 
| 99 99 | 
             
            #   
         | 
| 100 | 
            -
            #   -  | 
| 100 | 
            +
            #   - replace_variables (bool)
         | 
| 101 101 | 
             
            #       * Set to true if Telerivet will render variables like [[contact.name]] in the message
         | 
| 102 102 | 
             
            #           content, false otherwise
         | 
| 103 103 | 
             
            #       * Read-only
         | 
| @@ -144,6 +144,13 @@ module Telerivet | |
| 144 144 | 
             
            #       * Custom variables stored for this broadcast
         | 
| 145 145 | 
             
            #       * Read-only
         | 
| 146 146 | 
             
            #   
         | 
| 147 | 
            +
            #   - route_params (Hash)
         | 
| 148 | 
            +
            #       * Route-specific parameters for the messages in the broadcast. The parameters object
         | 
| 149 | 
            +
            #           may have keys matching the `phone_type` field of a phone (basic route) that may be
         | 
| 150 | 
            +
            #           used to send messages in this broadcast. The corresponding value is an object with
         | 
| 151 | 
            +
            #           route-specific parameters to use when sending messages with that type of route.
         | 
| 152 | 
            +
            #       * Read-only
         | 
| 153 | 
            +
            #   
         | 
| 147 154 | 
             
            #   - price (number)
         | 
| 148 155 | 
             
            #       * The total price of all messages in this broadcast, if known.
         | 
| 149 156 | 
             
            #       * Read-only
         | 
| @@ -250,8 +257,8 @@ class Broadcast < Entity | |
| 250 257 | 
             
                    get('tts_voice')
         | 
| 251 258 | 
             
                end
         | 
| 252 259 |  | 
| 253 | 
            -
                def  | 
| 254 | 
            -
                    get(' | 
| 260 | 
            +
                def replace_variables
         | 
| 261 | 
            +
                    get('replace_variables')
         | 
| 255 262 | 
             
                end
         | 
| 256 263 |  | 
| 257 264 | 
             
                def status
         | 
| @@ -282,6 +289,10 @@ class Broadcast < Entity | |
| 282 289 | 
             
                    get('media')
         | 
| 283 290 | 
             
                end
         | 
| 284 291 |  | 
| 292 | 
            +
                def route_params
         | 
| 293 | 
            +
                    get('route_params')
         | 
| 294 | 
            +
                end
         | 
| 295 | 
            +
             | 
| 285 296 | 
             
                def price
         | 
| 286 297 | 
             
                    get('price')
         | 
| 287 298 | 
             
                end
         | 
    
        data/lib/telerivet/contact.rb
    CHANGED
    
    | @@ -63,8 +63,8 @@ module Telerivet | |
| 63 63 | 
             
            #       * Read-only
         | 
| 64 64 | 
             
            #   
         | 
| 65 65 | 
             
            #   - default_route_id
         | 
| 66 | 
            -
            #       * ID of the phone or route that Telerivet will use by default to | 
| 67 | 
            -
            #           contact (null if using project default route)
         | 
| 66 | 
            +
            #       * ID of the basic route (phone) or custom route that Telerivet will use by default to
         | 
| 67 | 
            +
            #           send messages to this contact (null if using project default route)
         | 
| 68 68 | 
             
            #       * Updatable via API
         | 
| 69 69 | 
             
            #   
         | 
| 70 70 | 
             
            #   - group_ids (array of strings)
         | 
| @@ -134,7 +134,7 @@ class Contact < Entity | |
| 134 134 | 
             
                #     
         | 
| 135 135 | 
             
                #     - message_type
         | 
| 136 136 | 
             
                #         * Filter messages by message_type
         | 
| 137 | 
            -
                #         * Allowed values: sms, mms, ussd, call, service
         | 
| 137 | 
            +
                #         * Allowed values: sms, mms, ussd, ussd_session, call, chat, service
         | 
| 138 138 | 
             
                #     
         | 
| 139 139 | 
             
                #     - source
         | 
| 140 140 | 
             
                #         * Filter messages by source
         | 
| @@ -147,7 +147,7 @@ class Contact < Entity | |
| 147 147 | 
             
                #     - status
         | 
| 148 148 | 
             
                #         * Filter messages by status
         | 
| 149 149 | 
             
                #         * Allowed values: ignored, processing, received, sent, queued, failed,
         | 
| 150 | 
            -
                #             failed_queued, cancelled, delivered, not_delivered
         | 
| 150 | 
            +
                #             failed_queued, cancelled, delivered, not_delivered, read
         | 
| 151 151 | 
             
                #     
         | 
| 152 152 | 
             
                #     - time_created[min] (UNIX timestamp)
         | 
| 153 153 | 
             
                #         * Filter messages created on or after a particular time
         | 
| @@ -157,18 +157,26 @@ class Contact < Entity | |
| 157 157 | 
             
                #     
         | 
| 158 158 | 
             
                #     - external_id
         | 
| 159 159 | 
             
                #         * Filter messages by ID from an external provider
         | 
| 160 | 
            +
                #         * Allowed modifiers: external_id[ne], external_id[exists]
         | 
| 160 161 | 
             
                #     
         | 
| 161 162 | 
             
                #     - contact_id
         | 
| 162 163 | 
             
                #         * ID of the contact who sent/received the message
         | 
| 164 | 
            +
                #         * Allowed modifiers: contact_id[ne], contact_id[exists]
         | 
| 163 165 | 
             
                #     
         | 
| 164 166 | 
             
                #     - phone_id
         | 
| 165 167 | 
             
                #         * ID of the phone (basic route) that sent/received the message
         | 
| 166 168 | 
             
                #     
         | 
| 167 169 | 
             
                #     - broadcast_id
         | 
| 168 170 | 
             
                #         * ID of the broadcast containing the message
         | 
| 171 | 
            +
                #         * Allowed modifiers: broadcast_id[ne], broadcast_id[exists]
         | 
| 169 172 | 
             
                #     
         | 
| 170 173 | 
             
                #     - scheduled_id
         | 
| 171 174 | 
             
                #         * ID of the scheduled message that created this message
         | 
| 175 | 
            +
                #         * Allowed modifiers: scheduled_id[ne], scheduled_id[exists]
         | 
| 176 | 
            +
                #     
         | 
| 177 | 
            +
                #     - group_id
         | 
| 178 | 
            +
                #         * Filter messages sent or received by contacts in a particular group. The group must
         | 
| 179 | 
            +
                #             be a normal group, not a dynamic group.
         | 
| 172 180 | 
             
                #     
         | 
| 173 181 | 
             
                #     - sort
         | 
| 174 182 | 
             
                #         * Sort the results based on a field
         | 
| @@ -245,20 +253,22 @@ class Contact < Entity | |
| 245 253 | 
             
                #     
         | 
| 246 254 | 
             
                #     - message_type
         | 
| 247 255 | 
             
                #         * Filter scheduled messages by message_type
         | 
| 248 | 
            -
                #         * Allowed values: sms, mms, ussd, call, service
         | 
| 256 | 
            +
                #         * Allowed values: sms, mms, ussd, ussd_session, call, chat, service
         | 
| 249 257 | 
             
                #     
         | 
| 250 258 | 
             
                #     - time_created (UNIX timestamp)
         | 
| 251 259 | 
             
                #         * Filter scheduled messages by time_created
         | 
| 252 | 
            -
                #         * Allowed modifiers: time_created[ | 
| 260 | 
            +
                #         * Allowed modifiers: time_created[min], time_created[max]
         | 
| 253 261 | 
             
                #     
         | 
| 254 262 | 
             
                #     - next_time (UNIX timestamp)
         | 
| 255 263 | 
             
                #         * Filter scheduled messages by next_time
         | 
| 256 | 
            -
                #         * Allowed modifiers: next_time[ | 
| 257 | 
            -
                # | 
| 264 | 
            +
                #         * Allowed modifiers: next_time[min], next_time[max], next_time[exists]
         | 
| 265 | 
            +
                #     
         | 
| 266 | 
            +
                #     - relative_scheduled_id
         | 
| 267 | 
            +
                #         * Filter scheduled messages created for a relative scheduled message
         | 
| 258 268 | 
             
                #     
         | 
| 259 269 | 
             
                #     - sort
         | 
| 260 270 | 
             
                #         * Sort the results based on a field
         | 
| 261 | 
            -
                #         * Allowed values: default,  | 
| 271 | 
            +
                #         * Allowed values: default, next_time
         | 
| 262 272 | 
             
                #         * Default: default
         | 
| 263 273 | 
             
                #     
         | 
| 264 274 | 
             
                #     - sort_dir
         | 
| @@ -290,7 +300,7 @@ class Contact < Entity | |
| 290 300 | 
             
                #     
         | 
| 291 301 | 
             
                #     - time_created (UNIX timestamp)
         | 
| 292 302 | 
             
                #         * Filter data rows by the time they were created
         | 
| 293 | 
            -
                #         * Allowed modifiers: time_created[ | 
| 303 | 
            +
                #         * Allowed modifiers: time_created[min], time_created[max]
         | 
| 294 304 | 
             
                #     
         | 
| 295 305 | 
             
                #     - sort
         | 
| 296 306 | 
             
                #         * Sort the results based on a field
         | 
    
        data/lib/telerivet/datatable.rb
    CHANGED
    
    | @@ -55,7 +55,7 @@ class DataTable < Entity | |
| 55 55 | 
             
                #     
         | 
| 56 56 | 
             
                #     - time_created (UNIX timestamp)
         | 
| 57 57 | 
             
                #         * Filter data rows by the time they were created
         | 
| 58 | 
            -
                #         * Allowed modifiers: time_created[ | 
| 58 | 
            +
                #         * Allowed modifiers: time_created[min], time_created[max]
         | 
| 59 59 | 
             
                #     
         | 
| 60 60 | 
             
                #     - contact_id
         | 
| 61 61 | 
             
                #         * Filter data rows associated with a particular contact
         | 
| @@ -169,25 +169,36 @@ class DataTable < Entity | |
| 169 169 | 
             
                #       * Required
         | 
| 170 170 | 
             
                #   
         | 
| 171 171 | 
             
                #   - options (Hash)
         | 
| 172 | 
            +
                #       * Required
         | 
| 172 173 | 
             
                #     
         | 
| 173 174 | 
             
                #     - name (string, max 64 characters)
         | 
| 174 175 | 
             
                #         * Display name for the field
         | 
| 175 176 | 
             
                #     
         | 
| 176 177 | 
             
                #     - type (string)
         | 
| 177 178 | 
             
                #         * Field type
         | 
| 178 | 
            -
                #         * Allowed values: text, long_text,  | 
| 179 | 
            -
                #              | 
| 179 | 
            +
                #         * Allowed values: text, long_text, secret, phone_number, email, url, audio, date,
         | 
| 180 | 
            +
                #             date_time, number, boolean, checkbox, select, radio
         | 
| 180 181 | 
             
                #     
         | 
| 181 182 | 
             
                #     - order (int)
         | 
| 182 183 | 
             
                #         * Order in which to display the field
         | 
| 183 184 | 
             
                #     
         | 
| 185 | 
            +
                #     - items (array)
         | 
| 186 | 
            +
                #         * Array of up to 100 objects containing `value` and `label` string properties to
         | 
| 187 | 
            +
                #             show in the dropdown list when type is `select`. Each `value` and `label` must be
         | 
| 188 | 
            +
                #             between 1 and 256 characters in length.
         | 
| 189 | 
            +
                #         * Required if type is `select`
         | 
| 190 | 
            +
                #     
         | 
| 184 191 | 
             
                #     - readonly (bool)
         | 
| 185 192 | 
             
                #         * Set to true to prevent editing the field in the Telerivet web app
         | 
| 193 | 
            +
                #     
         | 
| 194 | 
            +
                #     - lookup_key (bool)
         | 
| 195 | 
            +
                #         * Set to true to allow using this field as a lookup key when importing rows via the
         | 
| 196 | 
            +
                #             Telerivet web app
         | 
| 186 197 | 
             
                #   
         | 
| 187 198 | 
             
                # Returns:
         | 
| 188 199 | 
             
                #     object
         | 
| 189 200 | 
             
                #
         | 
| 190 | 
            -
                def set_field_metadata(variable, options | 
| 201 | 
            +
                def set_field_metadata(variable, options)
         | 
| 191 202 | 
             
                    return @api.do_request("POST", get_base_api_path() + "/fields/#{variable}", options)
         | 
| 192 203 | 
             
                end
         | 
| 193 204 |  | 
    
        data/lib/telerivet/group.rb
    CHANGED
    
    | @@ -54,24 +54,22 @@ class Group < Entity | |
| 54 54 | 
             
                #     
         | 
| 55 55 | 
             
                #     - time_created (UNIX timestamp)
         | 
| 56 56 | 
             
                #         * Filter contacts by time created
         | 
| 57 | 
            -
                #         * Allowed modifiers: time_created[ | 
| 57 | 
            +
                #         * Allowed modifiers: time_created[min], time_created[max]
         | 
| 58 58 | 
             
                #     
         | 
| 59 59 | 
             
                #     - last_message_time (UNIX timestamp)
         | 
| 60 60 | 
             
                #         * Filter contacts by last time a message was sent or received
         | 
| 61 | 
            -
                #         * Allowed modifiers: last_message_time[ | 
| 62 | 
            -
                #             last_message_time[ | 
| 61 | 
            +
                #         * Allowed modifiers: last_message_time[min], last_message_time[max],
         | 
| 62 | 
            +
                #             last_message_time[exists]
         | 
| 63 63 | 
             
                #     
         | 
| 64 64 | 
             
                #     - last_incoming_message_time (UNIX timestamp)
         | 
| 65 65 | 
             
                #         * Filter contacts by last time a message was received
         | 
| 66 | 
            -
                #         * Allowed modifiers: last_incoming_message_time[ | 
| 67 | 
            -
                #             last_incoming_message_time[ | 
| 68 | 
            -
                #             last_incoming_message_time[exists]
         | 
| 66 | 
            +
                #         * Allowed modifiers: last_incoming_message_time[min],
         | 
| 67 | 
            +
                #             last_incoming_message_time[max], last_incoming_message_time[exists]
         | 
| 69 68 | 
             
                #     
         | 
| 70 69 | 
             
                #     - last_outgoing_message_time (UNIX timestamp)
         | 
| 71 70 | 
             
                #         * Filter contacts by last time a message was sent
         | 
| 72 | 
            -
                #         * Allowed modifiers: last_outgoing_message_time[ | 
| 73 | 
            -
                #             last_outgoing_message_time[ | 
| 74 | 
            -
                #             last_outgoing_message_time[exists]
         | 
| 71 | 
            +
                #         * Allowed modifiers: last_outgoing_message_time[min],
         | 
| 72 | 
            +
                #             last_outgoing_message_time[max], last_outgoing_message_time[exists]
         | 
| 75 73 | 
             
                #     
         | 
| 76 74 | 
             
                #     - incoming_message_count (int)
         | 
| 77 75 | 
             
                #         * Filter contacts by number of messages received from the contact
         | 
| @@ -126,20 +124,22 @@ class Group < Entity | |
| 126 124 | 
             
                #     
         | 
| 127 125 | 
             
                #     - message_type
         | 
| 128 126 | 
             
                #         * Filter scheduled messages by message_type
         | 
| 129 | 
            -
                #         * Allowed values: sms, mms, ussd, call, service
         | 
| 127 | 
            +
                #         * Allowed values: sms, mms, ussd, ussd_session, call, chat, service
         | 
| 130 128 | 
             
                #     
         | 
| 131 129 | 
             
                #     - time_created (UNIX timestamp)
         | 
| 132 130 | 
             
                #         * Filter scheduled messages by time_created
         | 
| 133 | 
            -
                #         * Allowed modifiers: time_created[ | 
| 131 | 
            +
                #         * Allowed modifiers: time_created[min], time_created[max]
         | 
| 134 132 | 
             
                #     
         | 
| 135 133 | 
             
                #     - next_time (UNIX timestamp)
         | 
| 136 134 | 
             
                #         * Filter scheduled messages by next_time
         | 
| 137 | 
            -
                #         * Allowed modifiers: next_time[ | 
| 138 | 
            -
                # | 
| 135 | 
            +
                #         * Allowed modifiers: next_time[min], next_time[max], next_time[exists]
         | 
| 136 | 
            +
                #     
         | 
| 137 | 
            +
                #     - relative_scheduled_id
         | 
| 138 | 
            +
                #         * Filter scheduled messages created for a relative scheduled message
         | 
| 139 139 | 
             
                #     
         | 
| 140 140 | 
             
                #     - sort
         | 
| 141 141 | 
             
                #         * Sort the results based on a field
         | 
| 142 | 
            -
                #         * Allowed values: default,  | 
| 142 | 
            +
                #         * Allowed values: default, next_time
         | 
| 143 143 | 
             
                #         * Default: default
         | 
| 144 144 | 
             
                #     
         | 
| 145 145 | 
             
                #     - sort_dir
         | 
    
        data/lib/telerivet/label.rb
    CHANGED
    
    | @@ -39,7 +39,7 @@ class Label < Entity | |
| 39 39 | 
             
                #     
         | 
| 40 40 | 
             
                #     - message_type
         | 
| 41 41 | 
             
                #         * Filter messages by message_type
         | 
| 42 | 
            -
                #         * Allowed values: sms, mms, ussd, call, service
         | 
| 42 | 
            +
                #         * Allowed values: sms, mms, ussd, ussd_session, call, chat, service
         | 
| 43 43 | 
             
                #     
         | 
| 44 44 | 
             
                #     - source
         | 
| 45 45 | 
             
                #         * Filter messages by source
         | 
| @@ -52,7 +52,7 @@ class Label < Entity | |
| 52 52 | 
             
                #     - status
         | 
| 53 53 | 
             
                #         * Filter messages by status
         | 
| 54 54 | 
             
                #         * Allowed values: ignored, processing, received, sent, queued, failed,
         | 
| 55 | 
            -
                #             failed_queued, cancelled, delivered, not_delivered
         | 
| 55 | 
            +
                #             failed_queued, cancelled, delivered, not_delivered, read
         | 
| 56 56 | 
             
                #     
         | 
| 57 57 | 
             
                #     - time_created[min] (UNIX timestamp)
         | 
| 58 58 | 
             
                #         * Filter messages created on or after a particular time
         | 
| @@ -62,18 +62,26 @@ class Label < Entity | |
| 62 62 | 
             
                #     
         | 
| 63 63 | 
             
                #     - external_id
         | 
| 64 64 | 
             
                #         * Filter messages by ID from an external provider
         | 
| 65 | 
            +
                #         * Allowed modifiers: external_id[ne], external_id[exists]
         | 
| 65 66 | 
             
                #     
         | 
| 66 67 | 
             
                #     - contact_id
         | 
| 67 68 | 
             
                #         * ID of the contact who sent/received the message
         | 
| 69 | 
            +
                #         * Allowed modifiers: contact_id[ne], contact_id[exists]
         | 
| 68 70 | 
             
                #     
         | 
| 69 71 | 
             
                #     - phone_id
         | 
| 70 72 | 
             
                #         * ID of the phone (basic route) that sent/received the message
         | 
| 71 73 | 
             
                #     
         | 
| 72 74 | 
             
                #     - broadcast_id
         | 
| 73 75 | 
             
                #         * ID of the broadcast containing the message
         | 
| 76 | 
            +
                #         * Allowed modifiers: broadcast_id[ne], broadcast_id[exists]
         | 
| 74 77 | 
             
                #     
         | 
| 75 78 | 
             
                #     - scheduled_id
         | 
| 76 79 | 
             
                #         * ID of the scheduled message that created this message
         | 
| 80 | 
            +
                #         * Allowed modifiers: scheduled_id[ne], scheduled_id[exists]
         | 
| 81 | 
            +
                #     
         | 
| 82 | 
            +
                #     - group_id
         | 
| 83 | 
            +
                #         * Filter messages sent or received by contacts in a particular group. The group must
         | 
| 84 | 
            +
                #             be a normal group, not a dynamic group.
         | 
| 77 85 | 
             
                #     
         | 
| 78 86 | 
             
                #     - sort
         | 
| 79 87 | 
             
                #         * Sort the results based on a field
         | 
    
        data/lib/telerivet/message.rb
    CHANGED
    
    | @@ -18,12 +18,12 @@ module Telerivet | |
| 18 18 | 
             
            #   - status
         | 
| 19 19 | 
             
            #       * Current status of the message
         | 
| 20 20 | 
             
            #       * Allowed values: ignored, processing, received, sent, queued, failed, failed_queued,
         | 
| 21 | 
            -
            #           cancelled, delivered, not_delivered
         | 
| 21 | 
            +
            #           cancelled, delivered, not_delivered, read
         | 
| 22 22 | 
             
            #       * Read-only
         | 
| 23 23 | 
             
            #   
         | 
| 24 24 | 
             
            #   - message_type
         | 
| 25 25 | 
             
            #       * Type of the message
         | 
| 26 | 
            -
            #       * Allowed values: sms, mms, ussd, call, service
         | 
| 26 | 
            +
            #       * Allowed values: sms, mms, ussd, ussd_session, call, chat, service
         | 
| 27 27 | 
             
            #       * Read-only
         | 
| 28 28 | 
             
            #   
         | 
| 29 29 | 
             
            #   - source
         | 
| @@ -71,6 +71,13 @@ module Telerivet | |
| 71 71 | 
             
            #       * List of IDs of labels applied to this message
         | 
| 72 72 | 
             
            #       * Read-only
         | 
| 73 73 | 
             
            #   
         | 
| 74 | 
            +
            #   - route_params (Hash)
         | 
| 75 | 
            +
            #       * Route-specific parameters for the message. The parameters object may have keys
         | 
| 76 | 
            +
            #           matching the `phone_type` field of a phone (basic route) that may be used to send the
         | 
| 77 | 
            +
            #           message. The corresponding value is an object with route-specific parameters to use
         | 
| 78 | 
            +
            #           when the message is sent by that type of route.
         | 
| 79 | 
            +
            #       * Read-only
         | 
| 80 | 
            +
            #   
         | 
| 74 81 | 
             
            #   - vars (Hash)
         | 
| 75 82 | 
             
            #       * Custom variables stored for this message
         | 
| 76 83 | 
             
            #       * Updatable via API
         | 
| @@ -86,8 +93,12 @@ module Telerivet | |
| 86 93 | 
             
            #       * Updatable via API
         | 
| 87 94 | 
             
            #   
         | 
| 88 95 | 
             
            #   - external_id
         | 
| 89 | 
            -
            #       * The ID of this message from an external SMS gateway provider (e.g. Twilio or | 
| 90 | 
            -
            #           if available.
         | 
| 96 | 
            +
            #       * The ID of this message from an external SMS gateway provider (e.g. Twilio or
         | 
| 97 | 
            +
            #           Vonage), if available.
         | 
| 98 | 
            +
            #       * Read-only
         | 
| 99 | 
            +
            #   
         | 
| 100 | 
            +
            #   - num_parts (number)
         | 
| 101 | 
            +
            #       * The number of SMS parts associated with the message, if applicable and if known.
         | 
| 91 102 | 
             
            #       * Read-only
         | 
| 92 103 | 
             
            #   
         | 
| 93 104 | 
             
            #   - price (number)
         | 
| @@ -122,15 +133,6 @@ module Telerivet | |
| 122 133 | 
             
            #       * Allowed values: female, male
         | 
| 123 134 | 
             
            #       * Read-only
         | 
| 124 135 | 
             
            #   
         | 
| 125 | 
            -
            #   - mms_parts (array)
         | 
| 126 | 
            -
            #       * A list of parts in the MMS message, the same as returned by the
         | 
| 127 | 
            -
            #           [getMMSParts](#Message.getMMSParts) method.
         | 
| 128 | 
            -
            #           
         | 
| 129 | 
            -
            #           Note: This property is only present when retrieving an individual
         | 
| 130 | 
            -
            #           MMS message by ID, not when querying a list of messages. In other cases, use
         | 
| 131 | 
            -
            #           [getMMSParts](#Message.getMMSParts).
         | 
| 132 | 
            -
            #       * Read-only
         | 
| 133 | 
            -
            #   
         | 
| 134 136 | 
             
            #   - track_clicks (boolean)
         | 
| 135 137 | 
             
            #       * If true, URLs in the message content are short URLs that redirect to a destination
         | 
| 136 138 | 
             
            #           URL.
         | 
| @@ -138,12 +140,22 @@ module Telerivet | |
| 138 140 | 
             
            #   
         | 
| 139 141 | 
             
            #   - short_urls (array)
         | 
| 140 142 | 
             
            #       * For text messages containing short URLs, this is an array of objects with the
         | 
| 141 | 
            -
            #           properties `short_url`, `link_type`,  | 
| 142 | 
            -
            #           clicked) | 
| 143 | 
            -
            #           property. If `link_type` is "media", the object also | 
| 144 | 
            -
            #           property (the index in the media array). If `link_type` is | 
| 145 | 
            -
            #           contains a `service_id` property. This property is | 
| 146 | 
            -
            #           contain short URLs.
         | 
| 143 | 
            +
            #           properties `short_url`, `link_type`, `time_clicked` (the first time that URL was
         | 
| 144 | 
            +
            #           clicked), and `expiration_time`. If `link_type` is "redirect", the object also
         | 
| 145 | 
            +
            #           contains a `destination_url` property. If `link_type` is "media", the object also
         | 
| 146 | 
            +
            #           contains an `media_index` property (the index in the media array). If `link_type` is
         | 
| 147 | 
            +
            #           "service", the object also contains a `service_id` property. This property is
         | 
| 148 | 
            +
            #           undefined for messages that do not contain short URLs.
         | 
| 149 | 
            +
            #       * Read-only
         | 
| 150 | 
            +
            #   
         | 
| 151 | 
            +
            #   - network_code (string)
         | 
| 152 | 
            +
            #       * A string identifying the network that sent or received the message, if known. For
         | 
| 153 | 
            +
            #           mobile networks, this string contains the 3-digit mobile country code (MCC) followed
         | 
| 154 | 
            +
            #           by the 2- or 3-digit mobile network code (MNC), which results in a 5- or 6-digit
         | 
| 155 | 
            +
            #           number. For lists of mobile network operators and their corresponding MCC/MNC values,
         | 
| 156 | 
            +
            #           see [Mobile country code Wikipedia
         | 
| 157 | 
            +
            #           article](https://en.wikipedia.org/wiki/Mobile_country_code). The network_code property
         | 
| 158 | 
            +
            #           may be non-numeric for messages not sent via mobile networks.
         | 
| 147 159 | 
             
            #       * Read-only
         | 
| 148 160 | 
             
            #   
         | 
| 149 161 | 
             
            #   - media (array)
         | 
| @@ -154,6 +166,27 @@ module Telerivet | |
| 154 166 | 
             
            #           temporary and may not be valid for more than 1 day.
         | 
| 155 167 | 
             
            #       * Read-only
         | 
| 156 168 | 
             
            #   
         | 
| 169 | 
            +
            #   - mms_parts (array)
         | 
| 170 | 
            +
            #       * A list of parts in the MMS message (only for incoming MMS messages received via
         | 
| 171 | 
            +
            #           Telerivet Gateway Android app).
         | 
| 172 | 
            +
            #           
         | 
| 173 | 
            +
            #           Each MMS part in the list is an object with the following
         | 
| 174 | 
            +
            #           properties:
         | 
| 175 | 
            +
            #           
         | 
| 176 | 
            +
            #           - cid: MMS content-id
         | 
| 177 | 
            +
            #           - type: MIME type
         | 
| 178 | 
            +
            #           - filename: original filename
         | 
| 179 | 
            +
            #           - size (int): number of bytes
         | 
| 180 | 
            +
            #           - url: URL where the content for this part is stored (secret but
         | 
| 181 | 
            +
            #           publicly accessible, so you could link/embed it in a web page without having to
         | 
| 182 | 
            +
            #           re-host it yourself)
         | 
| 183 | 
            +
            #           
         | 
| 184 | 
            +
            #           In general, the `media` property of the message is recommended for
         | 
| 185 | 
            +
            #           retrieving information about MMS media files, instead of `mms_parts`.
         | 
| 186 | 
            +
            #           The `mms_parts` property is also only present when retrieving an
         | 
| 187 | 
            +
            #           individual MMS message by ID, not when querying a list of messages.
         | 
| 188 | 
            +
            #       * Read-only
         | 
| 189 | 
            +
            #   
         | 
| 157 190 | 
             
            #   - time_clicked (UNIX timestamp)
         | 
| 158 191 | 
             
            #       * If the message contains any short URLs, this is the first time that a short URL in
         | 
| 159 192 | 
             
            #           the message was clicked.  This property is undefined for messages that do not contain
         | 
| @@ -237,18 +270,15 @@ class Message < Entity | |
| 237 270 | 
             
                end
         | 
| 238 271 |  | 
| 239 272 | 
             
                #
         | 
| 240 | 
            -
                # Retrieves a list of MMS parts for this message ( | 
| 273 | 
            +
                # (Deprecated) Retrieves a list of MMS parts for this message (only for incoming MMS messages
         | 
| 274 | 
            +
                # received via Telerivet Gateway Android app).
         | 
| 275 | 
            +
                # Note: This only works for MMS messages received via the Telerivet
         | 
| 276 | 
            +
                # Gateway Android app.
         | 
| 277 | 
            +
                # In general, the `media` property of the message is recommended for
         | 
| 278 | 
            +
                # retrieving information about MMS media files.
         | 
| 241 279 | 
             
                # 
         | 
| 242 | 
            -
                #  | 
| 243 | 
            -
                #  | 
| 244 | 
            -
                # 
         | 
| 245 | 
            -
                # - cid: MMS content-id
         | 
| 246 | 
            -
                # - type: MIME type
         | 
| 247 | 
            -
                # - filename: original filename
         | 
| 248 | 
            -
                # - size (int): number of bytes
         | 
| 249 | 
            -
                # - url: URL where the content for this part is stored (secret but
         | 
| 250 | 
            -
                # publicly accessible, so you could link/embed it in a web page without having to re-host it
         | 
| 251 | 
            -
                # yourself)
         | 
| 280 | 
            +
                # The return value has the same format as the `mms_parts` property of
         | 
| 281 | 
            +
                # the Message object.
         | 
| 252 282 | 
             
                # 
         | 
| 253 283 | 
             
                # Returns:
         | 
| 254 284 | 
             
                #     array
         | 
| @@ -364,6 +394,10 @@ class Message < Entity | |
| 364 394 | 
             
                    get('label_ids')
         | 
| 365 395 | 
             
                end
         | 
| 366 396 |  | 
| 397 | 
            +
                def route_params
         | 
| 398 | 
            +
                    get('route_params')
         | 
| 399 | 
            +
                end
         | 
| 400 | 
            +
             | 
| 367 401 | 
             
                def priority
         | 
| 368 402 | 
             
                    get('priority')
         | 
| 369 403 | 
             
                end
         | 
| @@ -380,6 +414,10 @@ class Message < Entity | |
| 380 414 | 
             
                    get('external_id')
         | 
| 381 415 | 
             
                end
         | 
| 382 416 |  | 
| 417 | 
            +
                def num_parts
         | 
| 418 | 
            +
                    get('num_parts')
         | 
| 419 | 
            +
                end
         | 
| 420 | 
            +
             | 
| 383 421 | 
             
                def price
         | 
| 384 422 | 
             
                    get('price')
         | 
| 385 423 | 
             
                end
         | 
| @@ -408,10 +446,6 @@ class Message < Entity | |
| 408 446 | 
             
                    get('tts_voice')
         | 
| 409 447 | 
             
                end
         | 
| 410 448 |  | 
| 411 | 
            -
                def mms_parts
         | 
| 412 | 
            -
                    get('mms_parts')
         | 
| 413 | 
            -
                end
         | 
| 414 | 
            -
             | 
| 415 449 | 
             
                def track_clicks
         | 
| 416 450 | 
             
                    get('track_clicks')
         | 
| 417 451 | 
             
                end
         | 
| @@ -420,10 +454,18 @@ class Message < Entity | |
| 420 454 | 
             
                    get('short_urls')
         | 
| 421 455 | 
             
                end
         | 
| 422 456 |  | 
| 457 | 
            +
                def network_code
         | 
| 458 | 
            +
                    get('network_code')
         | 
| 459 | 
            +
                end
         | 
| 460 | 
            +
             | 
| 423 461 | 
             
                def media
         | 
| 424 462 | 
             
                    get('media')
         | 
| 425 463 | 
             
                end
         | 
| 426 464 |  | 
| 465 | 
            +
                def mms_parts
         | 
| 466 | 
            +
                    get('mms_parts')
         | 
| 467 | 
            +
                end
         | 
| 468 | 
            +
             | 
| 427 469 | 
             
                def time_clicked
         | 
| 428 470 | 
             
                    get('time_clicked')
         | 
| 429 471 | 
             
                end
         |