Sha256: 7f0443f2816e74b5b53c9ae6f5c47a1772de92b95eabe186cb5b383652549760

Contents?: true

Size: 984 Bytes

Versions: 81

Compression:

Stored size: 984 Bytes

Contents

#
# deviceId string Device ID (36-char UUID)
# startAt string The earliest date to include in the results. 	format: date-time
# stopAt string The latest date to include in the results. 	format: date-time
#

# Method: devices.register
module Alula
  class DeviceCellularHistoryProc < Alula::RpcResource
    ONE_DAY = 86_400
    class Response < Alula::RpcResponse
    end

    def self.call(device_id:, start_at: nil, stop_at: nil)
      # Helpers to set start/stop if only one is passed
      seven_days_in_seconds = Alula::DeviceCellularHistoryProc::ONE_DAY * 7

      stop_at = start_at + seven_days_in_seconds if stop_at.nil?
      start_at = stop_at - seven_days_in_seconds if start_at.nil?

      request(
        http_method: :post,
        path: '/rpc/v1/devices/cellular/history/get',
        payload: {
          deviceId: device_id,
          startAt: start_at.utc.iso8601,
          stopAt: stop_at.utc.iso8601
        },
        handler: Response
      )
    end
  end
end

Version data entries

81 entries across 81 versions & 1 rubygems

Version Path
alula-ruby-1.9.13 lib/alula/procedures/device_cellular_history_proc.rb
alula-ruby-1.9.12 lib/alula/procedures/device_cellular_history_proc.rb
alula-ruby-1.9.11 lib/alula/procedures/device_cellular_history_proc.rb
alula-ruby-1.9.10 lib/alula/procedures/device_cellular_history_proc.rb
alula-ruby-1.9.9 lib/alula/procedures/device_cellular_history_proc.rb
alula-ruby-1.9.8 lib/alula/procedures/device_cellular_history_proc.rb
alula-ruby-1.9.7 lib/alula/procedures/device_cellular_history_proc.rb
alula-ruby-1.9.6 lib/alula/procedures/device_cellular_history_proc.rb
alula-ruby-1.9.5 lib/alula/procedures/device_cellular_history_proc.rb
alula-ruby-1.9.4 lib/alula/procedures/device_cellular_history_proc.rb
alula-ruby-1.9.3 lib/alula/procedures/device_cellular_history_proc.rb
alula-ruby-1.9.2 lib/alula/procedures/device_cellular_history_proc.rb
alula-ruby-1.9.1 lib/alula/procedures/device_cellular_history_proc.rb
alula-ruby-1.9.0 lib/alula/procedures/device_cellular_history_proc.rb
alula-ruby-1.8.1 lib/alula/procedures/device_cellular_history_proc.rb
alula-ruby-1.8.0 lib/alula/procedures/device_cellular_history_proc.rb
alula-ruby-1.7.0 lib/alula/procedures/device_cellular_history_proc.rb
alula-ruby-1.6.0 lib/alula/procedures/device_cellular_history_proc.rb
alula-ruby-1.5.0 lib/alula/procedures/device_cellular_history_proc.rb
alula-ruby-1.4.0 lib/alula/procedures/device_cellular_history_proc.rb