Class: Ondotori::WebAPI::Client
- Inherits:
-
Object
- Object
- Ondotori::WebAPI::Client
- Defined in:
- lib/ondotori/webapi/client.rb
Instance Attribute Summary collapse
-
#web_access ⇒ Object
writeonly
Sets the attribute web_access.
Instance Method Summary collapse
- #base_uri ⇒ Object
- #current(remote_serial_list: [], base_serial_list: []) ⇒ Object
- #data(serial, from: nil, to: nil, limit: nil) ⇒ Object
-
#initialize(params = {}, uri: "") ⇒ Client
constructor
A new instance of Client.
- #latest_data(serial) ⇒ Object
- #latest_data_rtr500(base: "", remote: "") ⇒ Object
Constructor Details
#initialize(params = {}, uri: "") ⇒ Client
Returns a new instance of Client.
6 7 8 9 10 11 |
# 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 |
Instance Attribute Details
#web_access=(value) ⇒ Object (writeonly)
Sets the attribute web_access
47 48 49 |
# File 'lib/ondotori/webapi/client.rb', line 47 def web_access=(value) @web_access = value end |
Instance Method Details
#base_uri ⇒ Object
41 42 43 44 45 |
# File 'lib/ondotori/webapi/client.rb', line 41 def base_uri return @uri unless @uri.empty? @ondotori_uri.uri end |
#current(remote_serial_list: [], base_serial_list: []) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/ondotori/webapi/client.rb', line 13 def current(remote_serial_list: [], base_serial_list: []) current_param = Api::CurrentParams.new(@param, remote: remote_serial_list, base: base_serial_list) response = @web_access.access("#{base_uri}current", current_param.to_ondotori_param) ondotori_response = Ondotori::WebAPI::Api::Response.new(response) ondotori_response.result end |
#data(serial, from: nil, to: nil, limit: nil) ⇒ Object
34 35 36 37 38 39 |
# File 'lib/ondotori/webapi/client.rb', line 34 def data(serial, from: nil, to: nil, limit: nil) param = Api::DataParams.new(@param, serial, from: from, to: to, limit: limit) response = @web_access.access("#{base_uri}data", param.to_ondotori_param) ondotori_response = Ondotori::WebAPI::Api::Response.new(response) ondotori_response.result end |
#latest_data(serial) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/ondotori/webapi/client.rb', line 20 def latest_data(serial) param = Api::LatestDataParams.new(@param, serial: serial) response = @web_access.access("#{base_uri}latest-data", param.to_ondotori_param) ondotori_response = Ondotori::WebAPI::Api::Response.new(response) ondotori_response.result end |
#latest_data_rtr500(base: "", remote: "") ⇒ Object
27 28 29 30 31 32 |
# File 'lib/ondotori/webapi/client.rb', line 27 def latest_data_rtr500(base: "", remote: "") param = Api::LatestDataRTR500Params.new(@param, base: base, remote: remote) response = @web_access.access("#{base_uri}latest-data-rtr500", param.to_ondotori_param) ondotori_response = Ondotori::WebAPI::Api::Response.new(response) ondotori_response.result end |