class Ondotori::WebAPI::Api::CurrentParams

Public Class Methods

new(param, remote: [], base: []) click to toggle source
Calls superclass method Ondotori::WebAPI::Api::ParamsBase::new
# File lib/ondotori/webapi/api/params.rb, line 22
def initialize(param, remote: [], base: [])
  super(param)

  if remote.length.positive? && base.length.positive?
    raise Ondotori::WebAPI::Api::Errors::InvaildParameter.new(
      "Both remote_serial_list and base_serial_list cannot be set.", 9998
    )
  end
  @remote_serial_list = remote
  @base_serial_list = base
end

Public Instance Methods

to_ondotori_param() click to toggle source
# File lib/ondotori/webapi/api/params.rb, line 34
def to_ondotori_param
  params = super
  params["remote-serial"] = @remote_serial_list if @remote_serial_list.length.positive?
  params["base-serial"] = @base_serial_list if @base_serial_list.length.positive?

  params
end