class Ondotori::WebAPI::Api::DataParams

Public Class Methods

new(param, serial, data_range: nil) click to toggle source
Calls superclass method Ondotori::WebAPI::Api::ParamsBase::new
# File lib/ondotori/webapi/api/params.rb, line 84
def initialize(param, serial, data_range: nil)
  super(param)
  validate(serial)
  @data_range = data_range
  @serial = serial
end

Public Instance Methods

to_ondotori_param() click to toggle source
# File lib/ondotori/webapi/api/params.rb, line 99
def to_ondotori_param
  params = super
  params["remote-serial"] = @serial
  @data_range&.add_data_range(params)

  params
end
validate(serial) click to toggle source
# File lib/ondotori/webapi/api/params.rb, line 91
def validate(serial)
  unless serial.instance_of?(String)
    raise Ondotori::WebAPI::Api::Errors::InvaildParameter.new(
      "serial must be String.", 9991
    )
  end
end