losant_rest 1.0.8 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -0
  3. data/.travis.yml +3 -2
  4. data/README.md +19 -8
  5. data/docs/_schemas.md +210 -184
  6. data/docs/application.md +20 -0
  7. data/docs/applicationApiToken.md +130 -0
  8. data/docs/applicationApiTokens.md +83 -0
  9. data/docs/applicationKey.md +15 -0
  10. data/docs/applicationKeys.md +10 -0
  11. data/docs/applications.md +10 -0
  12. data/docs/auditLog.md +5 -0
  13. data/docs/auditLogs.md +5 -0
  14. data/docs/auth.md +20 -8
  15. data/docs/dashboard.md +13 -0
  16. data/docs/dashboards.md +10 -0
  17. data/docs/data.md +10 -0
  18. data/docs/device.md +55 -0
  19. data/docs/deviceRecipe.md +20 -0
  20. data/docs/deviceRecipes.md +10 -0
  21. data/docs/devices.md +20 -0
  22. data/docs/event.md +15 -0
  23. data/docs/events.md +20 -0
  24. data/docs/flow.md +35 -0
  25. data/docs/flows.md +10 -0
  26. data/docs/me.md +61 -0
  27. data/docs/org.md +51 -0
  28. data/docs/orgInvites.md +6 -0
  29. data/docs/orgs.md +11 -0
  30. data/docs/solution.md +15 -0
  31. data/docs/solutionUser.md +15 -0
  32. data/docs/solutionUsers.md +10 -0
  33. data/docs/solutions.md +10 -0
  34. data/docs/webhook.md +15 -0
  35. data/docs/webhooks.md +10 -0
  36. data/lib/losant_rest.rb +2 -2
  37. data/lib/losant_rest/application.rb +24 -0
  38. data/lib/losant_rest/{access_token.rb → application_api_token.rb} +47 -23
  39. data/lib/losant_rest/{access_tokens.rb → application_api_tokens.rb} +27 -11
  40. data/lib/losant_rest/application_key.rb +18 -0
  41. data/lib/losant_rest/application_keys.rb +12 -0
  42. data/lib/losant_rest/applications.rb +12 -0
  43. data/lib/losant_rest/audit_log.rb +6 -0
  44. data/lib/losant_rest/audit_logs.rb +6 -0
  45. data/lib/losant_rest/auth.rb +20 -8
  46. data/lib/losant_rest/client.rb +8 -8
  47. data/lib/losant_rest/dashboard.rb +15 -0
  48. data/lib/losant_rest/dashboards.rb +12 -0
  49. data/lib/losant_rest/data.rb +12 -0
  50. data/lib/losant_rest/device.rb +66 -0
  51. data/lib/losant_rest/device_recipe.rb +24 -0
  52. data/lib/losant_rest/device_recipes.rb +12 -0
  53. data/lib/losant_rest/devices.rb +24 -0
  54. data/lib/losant_rest/event.rb +18 -0
  55. data/lib/losant_rest/events.rb +24 -0
  56. data/lib/losant_rest/flow.rb +42 -0
  57. data/lib/losant_rest/flows.rb +12 -0
  58. data/lib/losant_rest/me.rb +74 -0
  59. data/lib/losant_rest/org.rb +62 -0
  60. data/lib/losant_rest/org_invites.rb +6 -0
  61. data/lib/losant_rest/orgs.rb +14 -0
  62. data/lib/losant_rest/solution.rb +18 -0
  63. data/lib/losant_rest/solution_user.rb +18 -0
  64. data/lib/losant_rest/solution_users.rb +12 -0
  65. data/lib/losant_rest/solutions.rb +12 -0
  66. data/lib/losant_rest/version.rb +1 -1
  67. data/lib/losant_rest/webhook.rb +18 -0
  68. data/lib/losant_rest/webhooks.rb +12 -0
  69. data/losant_rest.gemspec +3 -3
  70. data/schemas/{accessToken.json → apiToken.json} +31 -3
  71. data/schemas/{accessTokenPatch.json → apiTokenPatch.json} +4 -0
  72. data/schemas/applicationApiTokenPost.json +116 -0
  73. data/schemas/auditLog.json +3 -1
  74. data/schemas/auditLogFilter.json +3 -1
  75. data/schemas/auditLogs.json +3 -1
  76. data/schemas/event.json +4 -2
  77. data/schemas/events.json +4 -2
  78. metadata +17 -19
  79. data/.rbenv-version +0 -1
  80. data/docs/accessToken.md +0 -107
  81. data/docs/accessTokens.md +0 -68
  82. data/schemas/accessTokenPost.json +0 -32
  83. data/schemas/accessTokens.json +0 -65
  84. data/schemas/deviceState.json +0 -31
@@ -31,6 +31,9 @@ module LosantRest
31
31
 
32
32
  # Gets information about an invite
33
33
  #
34
+ # Authentication:
35
+ # No api access token is required to call this action.
36
+ #
34
37
  # Parameters:
35
38
  # * {string} token - The token associated with the invite
36
39
  # * {string} email - The email associated with the invite
@@ -74,6 +77,9 @@ module LosantRest
74
77
 
75
78
  # Accepts/Rejects an invite
76
79
  #
80
+ # Authentication:
81
+ # No api access token is required to call this action.
82
+ #
77
83
  # Parameters:
78
84
  # * {hash} invite - Invite info and acceptance (https://api.losant.com/#/definitions/orgInviteAction)
79
85
  # * {string} losantdomain - Domain scope of request (rarely needed)
@@ -31,6 +31,12 @@ module LosantRest
31
31
 
32
32
  # Returns the organizations associated with the current user
33
33
  #
34
+ # Authentication:
35
+ # The client must be configured with a valid api
36
+ # access token to call this action. The token
37
+ # must include at least one of the following scopes:
38
+ # all.User, all.User.read, orgs.*, or orgs.get.
39
+ #
34
40
  # Parameters:
35
41
  # * {string} sortField - Field to sort the results by. Accepted values are: name, id, creationDate
36
42
  # * {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
@@ -38,6 +44,7 @@ module LosantRest
38
44
  # * {string} perPage - How many items to return per page
39
45
  # * {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name
40
46
  # * {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
47
+ # * {string} summaryExclude - List of summary fields to exclude from org summaries
41
48
  # * {string} losantdomain - Domain scope of request (rarely needed)
42
49
  # * {boolean} _actions - Return resource actions in response
43
50
  # * {boolean} _links - Return resource link in response
@@ -61,6 +68,7 @@ module LosantRest
61
68
  query_params[:perPage] = params[:perPage] if params.has_key?(:perPage)
62
69
  query_params[:filterField] = params[:filterField] if params.has_key?(:filterField)
63
70
  query_params[:filter] = params[:filter] if params.has_key?(:filter)
71
+ query_params[:summaryExclude] = params[:summaryExclude] if params.has_key?(:summaryExclude)
64
72
  headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
65
73
  query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
66
74
  query_params[:_links] = params[:_links] if params.has_key?(:_links)
@@ -78,6 +86,12 @@ module LosantRest
78
86
 
79
87
  # Create a new organization
80
88
  #
89
+ # Authentication:
90
+ # The client must be configured with a valid api
91
+ # access token to call this action. The token
92
+ # must include at least one of the following scopes:
93
+ # all.User, orgs.*, or orgs.post.
94
+ #
81
95
  # Parameters:
82
96
  # * {hash} organization - New organization information (https://api.losant.com/#/definitions/orgPost)
83
97
  # * {string} losantdomain - Domain scope of request (rarely needed)
@@ -31,6 +31,12 @@ module LosantRest
31
31
 
32
32
  # Deletes a solution
33
33
  #
34
+ # Authentication:
35
+ # The client must be configured with a valid api
36
+ # access token to call this action. The token
37
+ # must include at least one of the following scopes:
38
+ # all.Organization, all.User, solution.*, or solution.delete.
39
+ #
34
40
  # Parameters:
35
41
  # * {string} orgId - ID associated with the organization
36
42
  # * {string} solutionId - ID associated with the solution
@@ -71,6 +77,12 @@ module LosantRest
71
77
 
72
78
  # Retrieves information on a solution
73
79
  #
80
+ # Authentication:
81
+ # The client must be configured with a valid api
82
+ # access token to call this action. The token
83
+ # must include at least one of the following scopes:
84
+ # all.Organization, all.Organization.read, all.User, all.User.read, solution.*, or solution.get.
85
+ #
74
86
  # Parameters:
75
87
  # * {string} orgId - ID associated with the organization
76
88
  # * {string} solutionId - ID associated with the solution
@@ -111,6 +123,12 @@ module LosantRest
111
123
 
112
124
  # Updates information about a solution
113
125
  #
126
+ # Authentication:
127
+ # The client must be configured with a valid api
128
+ # access token to call this action. The token
129
+ # must include at least one of the following scopes:
130
+ # all.Organization, all.User, solution.*, or solution.patch.
131
+ #
114
132
  # Parameters:
115
133
  # * {string} orgId - ID associated with the organization
116
134
  # * {string} solutionId - ID associated with the solution
@@ -31,6 +31,12 @@ module LosantRest
31
31
 
32
32
  # Deletes a solution user
33
33
  #
34
+ # Authentication:
35
+ # The client must be configured with a valid api
36
+ # access token to call this action. The token
37
+ # must include at least one of the following scopes:
38
+ # all.Organization, all.User, solutionUser.*, or solutionUser.delete.
39
+ #
34
40
  # Parameters:
35
41
  # * {string} orgId - ID associated with the organization
36
42
  # * {string} solutionId - ID associated with the solution
@@ -73,6 +79,12 @@ module LosantRest
73
79
 
74
80
  # Retrieves information on a solution user
75
81
  #
82
+ # Authentication:
83
+ # The client must be configured with a valid api
84
+ # access token to call this action. The token
85
+ # must include at least one of the following scopes:
86
+ # all.Organization, all.Organization.read, all.User, all.User.read, solutionUser.*, or solutionUser.get.
87
+ #
76
88
  # Parameters:
77
89
  # * {string} orgId - ID associated with the organization
78
90
  # * {string} solutionId - ID associated with the solution
@@ -115,6 +127,12 @@ module LosantRest
115
127
 
116
128
  # Updates information about a solution user
117
129
  #
130
+ # Authentication:
131
+ # The client must be configured with a valid api
132
+ # access token to call this action. The token
133
+ # must include at least one of the following scopes:
134
+ # all.Organization, all.User, solutionUser.*, or solutionUser.patch.
135
+ #
118
136
  # Parameters:
119
137
  # * {string} orgId - ID associated with the organization
120
138
  # * {string} solutionId - ID associated with the solution
@@ -31,6 +31,12 @@ module LosantRest
31
31
 
32
32
  # Returns the users for the solution
33
33
  #
34
+ # Authentication:
35
+ # The client must be configured with a valid api
36
+ # access token to call this action. The token
37
+ # must include at least one of the following scopes:
38
+ # all.Organization, all.Organization.read, all.User, all.User.read, solutionUsers.*, or solutionUsers.get.
39
+ #
34
40
  # Parameters:
35
41
  # * {string} orgId - ID associated with the organization
36
42
  # * {string} solutionId - ID associated with the solution
@@ -82,6 +88,12 @@ module LosantRest
82
88
 
83
89
  # Create a new solution user
84
90
  #
91
+ # Authentication:
92
+ # The client must be configured with a valid api
93
+ # access token to call this action. The token
94
+ # must include at least one of the following scopes:
95
+ # all.Organization, all.User, solutionUsers.*, or solutionUsers.post.
96
+ #
85
97
  # Parameters:
86
98
  # * {string} orgId - ID associated with the organization
87
99
  # * {string} solutionId - ID associated with the solution
@@ -31,6 +31,12 @@ module LosantRest
31
31
 
32
32
  # Returns the solutions for the organization
33
33
  #
34
+ # Authentication:
35
+ # The client must be configured with a valid api
36
+ # access token to call this action. The token
37
+ # must include at least one of the following scopes:
38
+ # all.Organization, all.Organization.read, all.User, all.User.read, solutions.*, or solutions.get.
39
+ #
34
40
  # Parameters:
35
41
  # * {string} orgId - ID associated with the organization
36
42
  # * {string} sortField - Field to sort the results by. Accepted values are: name, id, creationDate
@@ -80,6 +86,12 @@ module LosantRest
80
86
 
81
87
  # Create a new solution
82
88
  #
89
+ # Authentication:
90
+ # The client must be configured with a valid api
91
+ # access token to call this action. The token
92
+ # must include at least one of the following scopes:
93
+ # all.Organization, all.User, solutions.*, or solutions.post.
94
+ #
83
95
  # Parameters:
84
96
  # * {string} orgId - ID associated with the organization
85
97
  # * {hash} solution - New solution information (https://api.losant.com/#/definitions/solutionPost)
@@ -21,5 +21,5 @@
21
21
  # SOFTWARE.
22
22
 
23
23
  module LosantRest
24
- VERSION = "1.0.8"
24
+ VERSION = "1.1.0"
25
25
  end
@@ -31,6 +31,12 @@ module LosantRest
31
31
 
32
32
  # Deletes a webhook
33
33
  #
34
+ # Authentication:
35
+ # The client must be configured with a valid api
36
+ # access token to call this action. The token
37
+ # must include at least one of the following scopes:
38
+ # all.Application, all.Organization, all.User, webhook.*, or webhook.delete.
39
+ #
34
40
  # Parameters:
35
41
  # * {string} applicationId - ID associated with the application
36
42
  # * {string} webhookId - ID associated with the webhook
@@ -71,6 +77,12 @@ module LosantRest
71
77
 
72
78
  # Retrieves information on a webhook
73
79
  #
80
+ # Authentication:
81
+ # The client must be configured with a valid api
82
+ # access token to call this action. The token
83
+ # must include at least one of the following scopes:
84
+ # all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, webhook.*, or webhook.get.
85
+ #
74
86
  # Parameters:
75
87
  # * {string} applicationId - ID associated with the application
76
88
  # * {string} webhookId - ID associated with the webhook
@@ -111,6 +123,12 @@ module LosantRest
111
123
 
112
124
  # Updates information about a webhook
113
125
  #
126
+ # Authentication:
127
+ # The client must be configured with a valid api
128
+ # access token to call this action. The token
129
+ # must include at least one of the following scopes:
130
+ # all.Application, all.Organization, all.User, webhook.*, or webhook.patch.
131
+ #
114
132
  # Parameters:
115
133
  # * {string} applicationId - ID associated with the application
116
134
  # * {string} webhookId - ID associated with the webhook
@@ -31,6 +31,12 @@ module LosantRest
31
31
 
32
32
  # Returns the webhooks for an application
33
33
  #
34
+ # Authentication:
35
+ # The client must be configured with a valid api
36
+ # access token to call this action. The token
37
+ # must include at least one of the following scopes:
38
+ # all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, webhooks.*, or webhooks.get.
39
+ #
34
40
  # Parameters:
35
41
  # * {string} applicationId - ID associated with the application
36
42
  # * {string} sortField - Field to sort the results by. Accepted values are: name, id, creationDate
@@ -81,6 +87,12 @@ module LosantRest
81
87
 
82
88
  # Create a new webhook for an application
83
89
  #
90
+ # Authentication:
91
+ # The client must be configured with a valid api
92
+ # access token to call this action. The token
93
+ # must include at least one of the following scopes:
94
+ # all.Application, all.Organization, all.User, webhooks.*, or webhooks.post.
95
+ #
84
96
  # Parameters:
85
97
  # * {string} applicationId - ID associated with the application
86
98
  # * {hash} webhook - New webhook information (https://api.losant.com/#/definitions/webhookPost)
@@ -17,9 +17,9 @@ Gem::Specification.new do |gem|
17
17
 
18
18
  gem.required_ruby_version = ">= 2.1"
19
19
 
20
- gem.add_dependency "httparty", "~> 0.13.0"
20
+ gem.add_dependency "httparty", "~> 0.14.0"
21
21
 
22
22
  gem.add_development_dependency "minitest", "~> 5.9"
23
- gem.add_development_dependency "rake", "~> 11"
24
- gem.add_development_dependency "webmock", "~> 2.1"
23
+ gem.add_development_dependency "rake", "~> 12"
24
+ gem.add_development_dependency "webmock", "~> 2.3"
25
25
  end
@@ -6,19 +6,45 @@
6
6
  "type": "string",
7
7
  "pattern": "^[A-Fa-f\\d]{24}$"
8
8
  },
9
- "accessTokenId": {
9
+ "apiTokenId": {
10
10
  "type": "string",
11
11
  "pattern": "^[A-Fa-f\\d]{24}$"
12
12
  },
13
- "userId": {
13
+ "ownerId": {
14
14
  "type": "string",
15
15
  "pattern": "^[A-Fa-f\\d]{24}$"
16
16
  },
17
+ "ownerType": {
18
+ "type": "string",
19
+ "enum": [
20
+ "application"
21
+ ]
22
+ },
23
+ "creatorId": {
24
+ "type": "string",
25
+ "pattern": "^[A-Fa-f\\d]{24}$"
26
+ },
27
+ "creatorType": {
28
+ "type": "string",
29
+ "enum": [
30
+ "apiToken",
31
+ "user",
32
+ "flow"
33
+ ]
34
+ },
35
+ "creatorName": {
36
+ "type": "string",
37
+ "maxLength": 1024
38
+ },
17
39
  "name": {
18
40
  "type": "string",
19
41
  "minLength": 1,
20
42
  "maxLength": 255
21
43
  },
44
+ "description": {
45
+ "type": "string",
46
+ "maxLength": 32767
47
+ },
22
48
  "creationDate": {
23
49
  "type": "string",
24
50
  "format": "date-time"
@@ -34,7 +60,9 @@
34
60
  "scope": {
35
61
  "type": "array",
36
62
  "items": {
37
- "type": "string"
63
+ "type": "string",
64
+ "minLength": 1,
65
+ "maxLength": 1024
38
66
  }
39
67
  },
40
68
  "status": {
@@ -7,6 +7,10 @@
7
7
  "minLength": 1,
8
8
  "maxLength": 255
9
9
  },
10
+ "description": {
11
+ "type": "string",
12
+ "maxLength": 32767
13
+ },
10
14
  "status": {
11
15
  "type": "string",
12
16
  "enum": [
@@ -0,0 +1,116 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type": "object",
4
+ "properties": {
5
+ "name": {
6
+ "type": "string",
7
+ "minLength": 1,
8
+ "maxLength": 255
9
+ },
10
+ "description": {
11
+ "type": "string",
12
+ "maxLength": 32767
13
+ },
14
+ "expirationDate": {
15
+ "type": "string",
16
+ "format": "date-time"
17
+ },
18
+ "scope": {
19
+ "type": "array",
20
+ "items": {
21
+ "type": "string",
22
+ "enum": [
23
+ "all.Application",
24
+ "all.Application.read",
25
+ "all.Device",
26
+ "all.Device.read",
27
+ "application.*",
28
+ "applicationApiToken.*",
29
+ "applicationApiTokens.*",
30
+ "applicationKey.*",
31
+ "applicationKeys.*",
32
+ "data.*",
33
+ "device.*",
34
+ "deviceRecipe.*",
35
+ "deviceRecipes.*",
36
+ "devices.*",
37
+ "event.*",
38
+ "events.*",
39
+ "flow.*",
40
+ "flows.*",
41
+ "webhook.*",
42
+ "webhooks.*",
43
+ "application.delete",
44
+ "application.get",
45
+ "application.patch",
46
+ "application.payloadCounts",
47
+ "applicationApiToken.delete",
48
+ "applicationApiToken.get",
49
+ "applicationApiToken.patch",
50
+ "applicationApiTokens.get",
51
+ "applicationApiTokens.post",
52
+ "applicationKey.delete",
53
+ "applicationKey.get",
54
+ "applicationKey.patch",
55
+ "applicationKeys.get",
56
+ "applicationKeys.post",
57
+ "data.lastValueQuery",
58
+ "data.timeSeriesQuery",
59
+ "device.delete",
60
+ "device.export",
61
+ "device.get",
62
+ "device.getCommand",
63
+ "device.getCompositeState",
64
+ "device.getLogEntries",
65
+ "device.getState",
66
+ "device.patch",
67
+ "device.removeData",
68
+ "device.sendCommand",
69
+ "device.sendState",
70
+ "deviceRecipe.bulkCreate",
71
+ "deviceRecipe.delete",
72
+ "deviceRecipe.get",
73
+ "deviceRecipe.patch",
74
+ "deviceRecipes.get",
75
+ "deviceRecipes.post",
76
+ "devices.export",
77
+ "devices.get",
78
+ "devices.post",
79
+ "devices.sendCommand",
80
+ "event.delete",
81
+ "event.get",
82
+ "event.patch",
83
+ "events.get",
84
+ "events.mostRecentBySeverity",
85
+ "events.patch",
86
+ "events.post",
87
+ "flow.delete",
88
+ "flow.get",
89
+ "flow.getStorageEntries",
90
+ "flow.log",
91
+ "flow.patch",
92
+ "flow.pressVirtualButton",
93
+ "flow.setStorageEntry",
94
+ "flows.create",
95
+ "flows.get",
96
+ "webhook.delete",
97
+ "webhook.get",
98
+ "webhook.patch",
99
+ "webhooks.get",
100
+ "webhooks.post"
101
+ ]
102
+ }
103
+ },
104
+ "status": {
105
+ "type": "string",
106
+ "enum": [
107
+ "active",
108
+ "inactive"
109
+ ]
110
+ }
111
+ },
112
+ "additionalProperties": false,
113
+ "required": [
114
+ "name"
115
+ ]
116
+ }