class Ondotori::WebAPI::Client
Attributes
web_access[W]
Public Class Methods
new(params = {}, uri: "")
click to toggle source
# File lib/ondotori/webapi/client.rb, line 6 def initialize(params = {}, uri: "") @param = Ondotori::WebAPI::Api::Param.new(params) @web_access = Ondotori::WebAPI::HttpWebAccess.new(30) @ondotori_uri = Ondotori::WebAPI::Api::URI.new(@param.login_id) @uri = uri end
Public Instance Methods
access_server(param, uri)
click to toggle source
# File lib/ondotori/webapi/client.rb, line 13 def access_server(param, uri) response = @web_access.access(uri, param.to_ondotori_param) ondotori_response = Ondotori::WebAPI::Api::Response.new(response) ondotori_response.result end
base_uri()
click to toggle source
# File lib/ondotori/webapi/client.rb, line 44 def base_uri return @uri unless @uri.empty? @ondotori_uri.uri end
current(remote_serial_list: [], base_serial_list: [])
click to toggle source
# File lib/ondotori/webapi/client.rb, line 19 def current(remote_serial_list: [], base_serial_list: []) param = Api::CurrentParams.new(@param, remote: remote_serial_list, base: base_serial_list) access_server(param, "#{base_uri}current") end
data(serial, data_range: nil)
click to toggle source
# File lib/ondotori/webapi/client.rb, line 34 def data(serial, data_range: nil) param = Api::DataParams.new(@param, serial, data_range: data_range) access_server(param, "#{base_uri}data") end
data_rtr500(base: "", remote: "", data_range: nil)
click to toggle source
# File lib/ondotori/webapi/client.rb, line 39 def data_rtr500(base: "", remote: "", data_range: nil) param = Api::DataRTR500Params.new(@param, remote, base, data_range: data_range) access_server(param, "#{base_uri}data-rtr500") end
latest_data(serial)
click to toggle source
# File lib/ondotori/webapi/client.rb, line 24 def latest_data(serial) param = Api::LatestDataParams.new(@param, serial: serial) access_server(param, "#{base_uri}latest-data") end
latest_data_rtr500(base: "", remote: "")
click to toggle source
# File lib/ondotori/webapi/client.rb, line 29 def latest_data_rtr500(base: "", remote: "") param = Api::LatestDataRTR500Params.new(@param, base: base, remote: remote) access_server(param, "#{base_uri}latest-data-rtr500") end