class LosantRest::Client
Losant API
User API for accessing Losant data
Built For Version 1.21.1
Attributes
auth_token[RW]
url[RW]
Public Class Methods
new(options = {})
click to toggle source
# File lib/losant_rest/client.rb, line 34 def initialize(options = {}) self.auth_token = options.fetch(:auth_token, nil) self.url = options.fetch(:url, "https://api.losant.com") end
Public Instance Methods
application()
click to toggle source
# File lib/losant_rest/client.rb, line 39 def application @application ||= Application.new(self) end
application_api_token()
click to toggle source
# File lib/losant_rest/client.rb, line 43 def application_api_token @application_api_token ||= ApplicationApiToken.new(self) end
application_api_tokens()
click to toggle source
# File lib/losant_rest/client.rb, line 47 def application_api_tokens @application_api_tokens ||= ApplicationApiTokens.new(self) end
application_certificate()
click to toggle source
# File lib/losant_rest/client.rb, line 51 def application_certificate @application_certificate ||= ApplicationCertificate.new(self) end
application_certificates()
click to toggle source
# File lib/losant_rest/client.rb, line 63 def application_certificates @application_certificates ||= ApplicationCertificates.new(self) end
application_dashboard()
click to toggle source
# File lib/losant_rest/client.rb, line 67 def application_dashboard @application_dashboard ||= ApplicationDashboard.new(self) end
application_dashboards()
click to toggle source
# File lib/losant_rest/client.rb, line 71 def application_dashboards @application_dashboards ||= ApplicationDashboards.new(self) end
application_key()
click to toggle source
# File lib/losant_rest/client.rb, line 75 def application_key @application_key ||= ApplicationKey.new(self) end
application_keys()
click to toggle source
# File lib/losant_rest/client.rb, line 79 def application_keys @application_keys ||= ApplicationKeys.new(self) end
application_template()
click to toggle source
# File lib/losant_rest/client.rb, line 83 def application_template @application_template ||= ApplicationTemplate.new(self) end
application_templates()
click to toggle source
# File lib/losant_rest/client.rb, line 87 def application_templates @application_templates ||= ApplicationTemplates.new(self) end
applications()
click to toggle source
# File lib/losant_rest/client.rb, line 91 def applications @applications ||= Applications.new(self) end
audit_log()
click to toggle source
# File lib/losant_rest/client.rb, line 95 def audit_log @audit_log ||= AuditLog.new(self) end
audit_logs()
click to toggle source
# File lib/losant_rest/client.rb, line 99 def audit_logs @audit_logs ||= AuditLogs.new(self) end
auth()
click to toggle source
# File lib/losant_rest/client.rb, line 103 def auth @auth ||= Auth.new(self) end
dashboard()
click to toggle source
# File lib/losant_rest/client.rb, line 107 def dashboard @dashboard ||= Dashboard.new(self) end
dashboards()
click to toggle source
# File lib/losant_rest/client.rb, line 111 def dashboards @dashboards ||= Dashboards.new(self) end
data()
click to toggle source
# File lib/losant_rest/client.rb, line 115 def data @data ||= Data.new(self) end
data_table()
click to toggle source
# File lib/losant_rest/client.rb, line 119 def data_table @data_table ||= DataTable.new(self) end
data_table_row()
click to toggle source
# File lib/losant_rest/client.rb, line 123 def data_table_row @data_table_row ||= DataTableRow.new(self) end
data_table_rows()
click to toggle source
# File lib/losant_rest/client.rb, line 127 def data_table_rows @data_table_rows ||= DataTableRows.new(self) end
data_tables()
click to toggle source
# File lib/losant_rest/client.rb, line 131 def data_tables @data_tables ||= DataTables.new(self) end
device()
click to toggle source
# File lib/losant_rest/client.rb, line 135 def device @device ||= Device.new(self) end
device_recipe()
click to toggle source
# File lib/losant_rest/client.rb, line 139 def device_recipe @device_recipe ||= DeviceRecipe.new(self) end
device_recipes()
click to toggle source
# File lib/losant_rest/client.rb, line 143 def device_recipes @device_recipes ||= DeviceRecipes.new(self) end
devices()
click to toggle source
# File lib/losant_rest/client.rb, line 147 def devices @devices ||= Devices.new(self) end
edge_deployment()
click to toggle source
# File lib/losant_rest/client.rb, line 151 def edge_deployment @edge_deployment ||= EdgeDeployment.new(self) end
edge_deployments()
click to toggle source
# File lib/losant_rest/client.rb, line 155 def edge_deployments @edge_deployments ||= EdgeDeployments.new(self) end
event()
click to toggle source
# File lib/losant_rest/client.rb, line 159 def event @event ||= Event.new(self) end
events()
click to toggle source
# File lib/losant_rest/client.rb, line 163 def events @events ||= Events.new(self) end
experience()
click to toggle source
# File lib/losant_rest/client.rb, line 167 def experience @experience ||= Experience.new(self) end
experience_domain()
click to toggle source
# File lib/losant_rest/client.rb, line 171 def experience_domain @experience_domain ||= ExperienceDomain.new(self) end
experience_domains()
click to toggle source
# File lib/losant_rest/client.rb, line 175 def experience_domains @experience_domains ||= ExperienceDomains.new(self) end
experience_endpoint()
click to toggle source
# File lib/losant_rest/client.rb, line 179 def experience_endpoint @experience_endpoint ||= ExperienceEndpoint.new(self) end
experience_endpoints()
click to toggle source
# File lib/losant_rest/client.rb, line 183 def experience_endpoints @experience_endpoints ||= ExperienceEndpoints.new(self) end
experience_group()
click to toggle source
# File lib/losant_rest/client.rb, line 187 def experience_group @experience_group ||= ExperienceGroup.new(self) end
experience_groups()
click to toggle source
# File lib/losant_rest/client.rb, line 191 def experience_groups @experience_groups ||= ExperienceGroups.new(self) end
experience_slug()
click to toggle source
# File lib/losant_rest/client.rb, line 195 def experience_slug @experience_slug ||= ExperienceSlug.new(self) end
experience_slugs()
click to toggle source
# File lib/losant_rest/client.rb, line 199 def experience_slugs @experience_slugs ||= ExperienceSlugs.new(self) end
experience_user()
click to toggle source
# File lib/losant_rest/client.rb, line 203 def experience_user @experience_user ||= ExperienceUser.new(self) end
experience_users()
click to toggle source
# File lib/losant_rest/client.rb, line 207 def experience_users @experience_users ||= ExperienceUsers.new(self) end
experience_version()
click to toggle source
# File lib/losant_rest/client.rb, line 211 def experience_version @experience_version ||= ExperienceVersion.new(self) end
experience_versions()
click to toggle source
# File lib/losant_rest/client.rb, line 215 def experience_versions @experience_versions ||= ExperienceVersions.new(self) end
experience_view()
click to toggle source
# File lib/losant_rest/client.rb, line 219 def experience_view @experience_view ||= ExperienceView.new(self) end
experience_views()
click to toggle source
# File lib/losant_rest/client.rb, line 223 def experience_views @experience_views ||= ExperienceViews.new(self) end
file()
click to toggle source
# File lib/losant_rest/client.rb, line 227 def file @file ||= File.new(self) end
files()
click to toggle source
# File lib/losant_rest/client.rb, line 231 def files @files ||= Files.new(self) end
flow()
click to toggle source
# File lib/losant_rest/client.rb, line 235 def flow @flow ||= Flow.new(self) end
flow_version()
click to toggle source
# File lib/losant_rest/client.rb, line 239 def flow_version @flow_version ||= FlowVersion.new(self) end
flow_versions()
click to toggle source
# File lib/losant_rest/client.rb, line 243 def flow_versions @flow_versions ||= FlowVersions.new(self) end
flows()
click to toggle source
# File lib/losant_rest/client.rb, line 247 def flows @flows ||= Flows.new(self) end
instance()
click to toggle source
# File lib/losant_rest/client.rb, line 251 def instance @instance ||= Instance.new(self) end
instance_api_token()
click to toggle source
# File lib/losant_rest/client.rb, line 255 def instance_api_token @instance_api_token ||= InstanceApiToken.new(self) end
instance_api_tokens()
click to toggle source
# File lib/losant_rest/client.rb, line 259 def instance_api_tokens @instance_api_tokens ||= InstanceApiTokens.new(self) end
instance_member()
click to toggle source
# File lib/losant_rest/client.rb, line 263 def instance_member @instance_member ||= InstanceMember.new(self) end
instance_members()
click to toggle source
# File lib/losant_rest/client.rb, line 267 def instance_members @instance_members ||= InstanceMembers.new(self) end
instance_org()
click to toggle source
# File lib/losant_rest/client.rb, line 271 def instance_org @instance_org ||= InstanceOrg.new(self) end
instance_org_invite()
click to toggle source
# File lib/losant_rest/client.rb, line 275 def instance_org_invite @instance_org_invite ||= InstanceOrgInvite.new(self) end
instance_org_invites()
click to toggle source
# File lib/losant_rest/client.rb, line 279 def instance_org_invites @instance_org_invites ||= InstanceOrgInvites.new(self) end
instance_org_member()
click to toggle source
# File lib/losant_rest/client.rb, line 283 def instance_org_member @instance_org_member ||= InstanceOrgMember.new(self) end
instance_org_members()
click to toggle source
# File lib/losant_rest/client.rb, line 287 def instance_org_members @instance_org_members ||= InstanceOrgMembers.new(self) end
instance_orgs()
click to toggle source
# File lib/losant_rest/client.rb, line 291 def instance_orgs @instance_orgs ||= InstanceOrgs.new(self) end
instances()
click to toggle source
# File lib/losant_rest/client.rb, line 295 def instances @instances ||= Instances.new(self) end
integration()
click to toggle source
# File lib/losant_rest/client.rb, line 299 def integration @integration ||= Integration.new(self) end
integrations()
click to toggle source
# File lib/losant_rest/client.rb, line 303 def integrations @integrations ||= Integrations.new(self) end
me()
click to toggle source
# File lib/losant_rest/client.rb, line 307 def me @me ||= Me.new(self) end
notebook()
click to toggle source
# File lib/losant_rest/client.rb, line 311 def notebook @notebook ||= Notebook.new(self) end
notebooks()
click to toggle source
# File lib/losant_rest/client.rb, line 315 def notebooks @notebooks ||= Notebooks.new(self) end
org()
click to toggle source
# File lib/losant_rest/client.rb, line 319 def org @org ||= Org.new(self) end
org_invites()
click to toggle source
# File lib/losant_rest/client.rb, line 323 def org_invites @org_invites ||= OrgInvites.new(self) end
orgs()
click to toggle source
# File lib/losant_rest/client.rb, line 327 def orgs @orgs ||= Orgs.new(self) end
request(options = {})
click to toggle source
# File lib/losant_rest/client.rb, line 347 def request(options = {}) headers = options.fetch(:headers, {}) method = options.fetch(:method, :get) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" headers["Accept-Version"] = "^1.21.1" headers["Authorization"] = "Bearer #{self.auth_token}" if self.auth_token path = self.url + options.fetch(:path, "") response = HTTParty.send(method, path, query: Utils.fix_query_arrays(options[:query]), body: options[:body] && options[:body].to_json(), headers: headers) result = response.parsed_response if response.code >= 400 raise ResponseError.new(response.code, result) end result end
user_api_token()
click to toggle source
# File lib/losant_rest/client.rb, line 331 def user_api_token @user_api_token ||= UserApiToken.new(self) end
user_api_tokens()
click to toggle source
# File lib/losant_rest/client.rb, line 335 def user_api_tokens @user_api_tokens ||= UserApiTokens.new(self) end
webhook()
click to toggle source
# File lib/losant_rest/client.rb, line 339 def webhook @webhook ||= Webhook.new(self) end
webhooks()
click to toggle source
# File lib/losant_rest/client.rb, line 343 def webhooks @webhooks ||= Webhooks.new(self) end