losant_rest 1.0.2 → 1.0.3

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.
@@ -0,0 +1,100 @@
1
+ module LosantRest
2
+
3
+ # Class containing all the actions for the Solutions Resource
4
+ class Solutions
5
+
6
+ def initialize(client)
7
+ @client = client
8
+ end
9
+
10
+ # Returns the solutions for the organization
11
+ #
12
+ # Parameters:
13
+ # * {string} orgId - ID associated with the organization
14
+ # * {string} sortField - Field to sort the results by. Accepted values are: name, id, creationDate
15
+ # * {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
16
+ # * {string} page - Which page of results to return
17
+ # * {string} perPage - How many items to return per page
18
+ # * {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name
19
+ # * {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
20
+ # * {string} losantdomain - Domain scope of request (rarely needed)
21
+ # * {boolean} _actions - Return resource actions in response
22
+ # * {boolean} _links - Return resource link in response
23
+ # * {boolean} _embedded - Return embedded resources in response
24
+ #
25
+ # Responses:
26
+ # * 200 - Collection of solutions (https://api.losant.com/#/definitions/solutions)
27
+ #
28
+ # Errors:
29
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
30
+ def get(params = {})
31
+ params = Utils.symbolize_hash_keys(params)
32
+ query_params = { _actions: false, _links: true, _embedded: true }
33
+ headers = {}
34
+ body = nil
35
+
36
+ raise ArgumentError.new("orgId is required") unless params.has_key?(:orgId)
37
+
38
+ query_params[:sortField] = params[:sortField] if params.has_key?(:sortField)
39
+ query_params[:sortDirection] = params[:sortDirection] if params.has_key?(:sortDirection)
40
+ query_params[:page] = params[:page] if params.has_key?(:page)
41
+ query_params[:perPage] = params[:perPage] if params.has_key?(:perPage)
42
+ query_params[:filterField] = params[:filterField] if params.has_key?(:filterField)
43
+ query_params[:filter] = params[:filter] if params.has_key?(:filter)
44
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
45
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
46
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
47
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
48
+
49
+ path = "/orgs/#{params[:orgId]}/solutions"
50
+
51
+ @client.request(
52
+ method: :get,
53
+ path: path,
54
+ query: query_params,
55
+ headers: headers,
56
+ body: body)
57
+ end
58
+
59
+ # Create a new solution
60
+ #
61
+ # Parameters:
62
+ # * {string} orgId - ID associated with the organization
63
+ # * {hash} solution - New solution information (https://api.losant.com/#/definitions/solutionPost)
64
+ # * {string} losantdomain - Domain scope of request (rarely needed)
65
+ # * {boolean} _actions - Return resource actions in response
66
+ # * {boolean} _links - Return resource link in response
67
+ # * {boolean} _embedded - Return embedded resources in response
68
+ #
69
+ # Responses:
70
+ # * 201 - Successfully created solution (https://api.losant.com/#/definitions/solution)
71
+ #
72
+ # Errors:
73
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
74
+ def post(params = {})
75
+ params = Utils.symbolize_hash_keys(params)
76
+ query_params = { _actions: false, _links: true, _embedded: true }
77
+ headers = {}
78
+ body = nil
79
+
80
+ raise ArgumentError.new("orgId is required") unless params.has_key?(:orgId)
81
+ raise ArgumentError.new("solution is required") unless params.has_key?(:solution)
82
+
83
+ body = params[:solution] if params.has_key?(:solution)
84
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
85
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
86
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
87
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
88
+
89
+ path = "/orgs/#{params[:orgId]}/solutions"
90
+
91
+ @client.request(
92
+ method: :post,
93
+ path: path,
94
+ query: query_params,
95
+ headers: headers,
96
+ body: body)
97
+ end
98
+
99
+ end
100
+ end
@@ -1,3 +1,3 @@
1
1
  module LosantRest
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  end
data/lib/losant_rest.rb CHANGED
@@ -22,6 +22,10 @@ require_relative "losant_rest/flows"
22
22
  require_relative "losant_rest/me"
23
23
  require_relative "losant_rest/org"
24
24
  require_relative "losant_rest/orgs"
25
+ require_relative "losant_rest/solution"
26
+ require_relative "losant_rest/solution_user"
27
+ require_relative "losant_rest/solution_users"
28
+ require_relative "losant_rest/solutions"
25
29
  require_relative "losant_rest/webhook"
26
30
  require_relative "losant_rest/webhooks"
27
31
  require_relative "losant_rest/client"
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type": "object",
4
+ "properties": {
5
+ "solutionUserId": {
6
+ "type": "string",
7
+ "pattern": "^[A-Fa-f\\d]{24}$"
8
+ },
9
+ "token": {
10
+ "type": "string",
11
+ "minLength": 1
12
+ }
13
+ },
14
+ "required": [
15
+ "solutionUserId",
16
+ "token"
17
+ ]
18
+ }
data/schemas/org.json CHANGED
@@ -27,6 +27,9 @@
27
27
  "type": "string",
28
28
  "maxLength": 32767
29
29
  },
30
+ "solutionsEnabled": {
31
+ "type": "boolean"
32
+ },
30
33
  "members": {
31
34
  "type": "array",
32
35
  "items": {
data/schemas/orgs.json CHANGED
@@ -34,6 +34,9 @@
34
34
  "type": "string",
35
35
  "maxLength": 32767
36
36
  },
37
+ "solutionsEnabled": {
38
+ "type": "boolean"
39
+ },
37
40
  "members": {
38
41
  "type": "array",
39
42
  "items": {
@@ -0,0 +1,74 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type": "object",
4
+ "properties": {
5
+ "id": {
6
+ "type": "string",
7
+ "pattern": "^[A-Fa-f\\d]{24}$"
8
+ },
9
+ "solutionId": {
10
+ "type": "string",
11
+ "pattern": "^[A-Fa-f\\d]{24}$"
12
+ },
13
+ "orgId": {
14
+ "type": "string",
15
+ "pattern": "^[A-Fa-f\\d]{24}$"
16
+ },
17
+ "creationDate": {
18
+ "type": "string",
19
+ "format": "date-time"
20
+ },
21
+ "lastUpdated": {
22
+ "type": "string",
23
+ "format": "date-time"
24
+ },
25
+ "name": {
26
+ "type": "string",
27
+ "minLength": 1,
28
+ "maxLength": 255
29
+ },
30
+ "description": {
31
+ "type": "string",
32
+ "maxLength": 32767
33
+ },
34
+ "slug": {
35
+ "type": "string",
36
+ "pattern": "^[0-9a-z_-]{1,255}$"
37
+ },
38
+ "allowSelfDeletion": {
39
+ "type": "boolean"
40
+ },
41
+ "allowSelfEmailChange": {
42
+ "type": "boolean"
43
+ },
44
+ "passwordReset": {
45
+ "type": "object",
46
+ "properties": {
47
+ "allowPasswordReset": {
48
+ "type": "boolean"
49
+ },
50
+ "emailSubject": {
51
+ "type": "string",
52
+ "maxLength": 255
53
+ },
54
+ "emailBody": {
55
+ "type": "string",
56
+ "maxLength": 32767
57
+ },
58
+ "emailFrom": {
59
+ "type": "string",
60
+ "format": "email",
61
+ "maxLength": 1024
62
+ }
63
+ }
64
+ },
65
+ "summary": {
66
+ "type": "object",
67
+ "properties": {
68
+ "solutionUserCount": {
69
+ "type": "number"
70
+ }
71
+ }
72
+ }
73
+ }
74
+ }
@@ -0,0 +1,48 @@
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
+ "slug": {
15
+ "type": "string",
16
+ "pattern": "^[0-9a-z_-]{1,255}$"
17
+ },
18
+ "allowSelfDeletion": {
19
+ "type": "boolean"
20
+ },
21
+ "allowSelfEmailChange": {
22
+ "type": "boolean"
23
+ },
24
+ "passwordReset": {
25
+ "type": "object",
26
+ "properties": {
27
+ "allowPasswordReset": {
28
+ "type": "boolean"
29
+ },
30
+ "emailSubject": {
31
+ "type": "string",
32
+ "maxLength": 255
33
+ },
34
+ "emailBody": {
35
+ "type": "string",
36
+ "maxLength": 32767
37
+ },
38
+ "emailFrom": {
39
+ "type": "string",
40
+ "format": "email",
41
+ "maxLength": 1024
42
+ }
43
+ },
44
+ "additionalProperties": false
45
+ },
46
+ "additionalProperties": false
47
+ }
48
+ }
@@ -0,0 +1,52 @@
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
+ "slug": {
15
+ "type": "string",
16
+ "pattern": "^[0-9a-z_-]{1,255}$"
17
+ },
18
+ "allowSelfDeletion": {
19
+ "type": "boolean"
20
+ },
21
+ "allowSelfEmailChange": {
22
+ "type": "boolean"
23
+ },
24
+ "passwordReset": {
25
+ "type": "object",
26
+ "properties": {
27
+ "allowPasswordReset": {
28
+ "type": "boolean"
29
+ },
30
+ "emailSubject": {
31
+ "type": "string",
32
+ "maxLength": 255
33
+ },
34
+ "emailBody": {
35
+ "type": "string",
36
+ "maxLength": 32767
37
+ },
38
+ "emailFrom": {
39
+ "type": "string",
40
+ "format": "email",
41
+ "maxLength": 1024
42
+ }
43
+ },
44
+ "additionalProperties": false
45
+ },
46
+ "required": [
47
+ "name",
48
+ "slug"
49
+ ],
50
+ "additionalProperties": false
51
+ }
52
+ }
@@ -0,0 +1,94 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type": "object",
4
+ "properties": {
5
+ "id": {
6
+ "type": "string",
7
+ "pattern": "^[A-Fa-f\\d]{24}$"
8
+ },
9
+ "solutionUserId": {
10
+ "type": "string",
11
+ "pattern": "^[A-Fa-f\\d]{24}$"
12
+ },
13
+ "solutionId": {
14
+ "type": "string",
15
+ "pattern": "^[A-Fa-f\\d]{24}$"
16
+ },
17
+ "orgId": {
18
+ "type": "string",
19
+ "pattern": "^[A-Fa-f\\d]{24}$"
20
+ },
21
+ "creationDate": {
22
+ "type": "string",
23
+ "format": "date-time"
24
+ },
25
+ "lastUpdated": {
26
+ "type": "string",
27
+ "format": "date-time"
28
+ },
29
+ "passwordLastUpdated": {
30
+ "type": "string",
31
+ "format": "date-time"
32
+ },
33
+ "lastLogin": {
34
+ "type": "string",
35
+ "format": "date-time"
36
+ },
37
+ "email": {
38
+ "type": "string",
39
+ "format": "email",
40
+ "maxLength": 1024
41
+ },
42
+ "firstName": {
43
+ "type": "string",
44
+ "minLength": 1,
45
+ "maxLength": 1024
46
+ },
47
+ "lastName": {
48
+ "type": "string",
49
+ "minLength": 1,
50
+ "maxLength": 1024
51
+ },
52
+ "companyName": {
53
+ "type": "string",
54
+ "maxLength": 1024
55
+ },
56
+ "phoneNumber": {
57
+ "type": "string",
58
+ "maxLength": 1024
59
+ },
60
+ "location": {
61
+ "type": "string",
62
+ "maxLength": 1024
63
+ },
64
+ "url": {
65
+ "type": "string",
66
+ "maxLength": 1024
67
+ },
68
+ "forcePasswordResetOnNextLogin": {
69
+ "type": "boolean"
70
+ },
71
+ "fullName": {
72
+ "type": "string"
73
+ },
74
+ "twoFactorAuthEnabled": {
75
+ "type": "boolean"
76
+ },
77
+ "avatarUrl": {
78
+ "type": "string",
79
+ "format": "url"
80
+ },
81
+ "accessRestrictions": {
82
+ "type": "object",
83
+ "properties": {
84
+ "dashboardIds": {
85
+ "type": "array",
86
+ "items": {
87
+ "type": "string",
88
+ "pattern": "^[A-Fa-f\\d]{24}$"
89
+ }
90
+ }
91
+ }
92
+ }
93
+ }
94
+ }
@@ -0,0 +1,30 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type": "object",
4
+ "properties": {
5
+ "solutionId": {
6
+ "type": "string",
7
+ "pattern": "^[A-Fa-f\\d]{24}$"
8
+ },
9
+ "email": {
10
+ "type": "string",
11
+ "format": "email",
12
+ "maxLength": 1024
13
+ },
14
+ "password": {
15
+ "type": "string",
16
+ "minLength": 8,
17
+ "maxLength": 2048
18
+ },
19
+ "twoFactorCode": {
20
+ "type": "string",
21
+ "maxLength": 2048
22
+ }
23
+ },
24
+ "required": [
25
+ "solutionId",
26
+ "email",
27
+ "password"
28
+ ],
29
+ "additionalProperties": false
30
+ }