Class: LosantRest::Flows
- Inherits:
-
Object
- Object
- LosantRest::Flows
- Defined in:
- lib/losant_rest/flows.rb
Overview
Class containing all the actions for the Flows Resource
Instance Method Summary collapse
-
#get(params = {}) ⇒ Object
Returns the flows for an application.
-
#get_by_version(params = {}) ⇒ Object
Returns the flows by version for an application.
-
#import(params = {}) ⇒ Object
Import a set of flows and flow versions.
-
#initialize(client) ⇒ Flows
constructor
A new instance of Flows.
-
#palette(params = {}) ⇒ Object
Gets additional nodes that should be available in the palette.
-
#post(params = {}) ⇒ Object
Create a new flow for an application.
Constructor Details
#initialize(client) ⇒ Flows
Returns a new instance of Flows.
30 31 32 |
# File 'lib/losant_rest/flows.rb', line 30 def initialize(client) @client = client end |
Instance Method Details
#get(params = {}) ⇒ Object
Returns the flows for an application
Authentication: The client must be configured with a valid api access token to call this action. The token must include at least one of the following scopes: all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, flows.*, or flows.get.
Parameters:
-
string applicationId - ID associated with the application
-
string sortField - Field to sort the results by. Accepted values are: name, id, creationDate, lastUpdated
-
string sortDirection - Direction to sort the results by. Accepted values are: asc, desc
-
string page - Which page of results to return
-
string perPage - How many items to return per page
-
string filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name
-
string filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
-
string flowClass - Filter the workflows by the given flow class. Accepted values are: edge, embedded, cloud, customNode, experience
-
hash triggerFilter - Array of triggers to filter by - always filters against default flow version. (api.losant.com/#/definitions/flowTriggerFilter)
-
string includeCustomNodes - If the result of the request should also include the details of any custom nodes referenced by the returned workflows
-
hash query - Workflow filter JSON object which overrides the filterField, filter, triggerFilter, and flowClass parameters. (api.losant.com/#/definitions/advancedFlowQuery)
-
string allVersions - If the request should also return flows with matching versions. Only applicable for requests with an advanced query.
-
string losantdomain - Domain scope of request (rarely needed)
-
boolean _actions - Return resource actions in response
-
boolean _links - Return resource link in response
-
boolean _embedded - Return embedded resources in response
Responses:
-
200 - Collection of flows (api.losant.com/#/definitions/flows)
Errors:
-
400 - Error if malformed request (api.losant.com/#/definitions/error)
-
404 - Error if application was not found (api.losant.com/#/definitions/error)
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/losant_rest/flows.rb', line 66 def get(params = {}) params = Utils.symbolize_hash_keys(params) query_params = { _actions: false, _links: true, _embedded: true } headers = {} body = nil raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId) query_params[:sortField] = params[:sortField] if params.has_key?(:sortField) query_params[:sortDirection] = params[:sortDirection] if params.has_key?(:sortDirection) query_params[:page] = params[:page] if params.has_key?(:page) query_params[:perPage] = params[:perPage] if params.has_key?(:perPage) query_params[:filterField] = params[:filterField] if params.has_key?(:filterField) query_params[:filter] = params[:filter] if params.has_key?(:filter) query_params[:flowClass] = params[:flowClass] if params.has_key?(:flowClass) query_params[:triggerFilter] = params[:triggerFilter] if params.has_key?(:triggerFilter) query_params[:includeCustomNodes] = params[:includeCustomNodes] if params.has_key?(:includeCustomNodes) query_params[:query] = params[:query] if params.has_key?(:query) query_params[:query] = JSON.dump(query_params[:query]) if query_params.has_key?(:query) query_params[:allVersions] = params[:allVersions] if params.has_key?(:allVersions) headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain) query_params[:_actions] = params[:_actions] if params.has_key?(:_actions) query_params[:_links] = params[:_links] if params.has_key?(:_links) query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded) path = "/applications/#{params[:applicationId]}/flows" @client.request( method: :get, path: path, query: query_params, headers: headers, body: body) end |
#get_by_version(params = {}) ⇒ Object
Returns the flows by version for an application
Authentication: The client must be configured with a valid api access token to call this action. The token must include at least one of the following scopes: all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, flows.*, or flows.getByVersion.
Parameters:
-
string applicationId - ID associated with the application
-
string sortField - Field to sort the results by. Accepted values are: name, id, creationDate, lastUpdated
-
string sortDirection - Direction to sort the results by. Accepted values are: asc, desc
-
string page - Which page of results to return
-
string perPage - How many items to return per page
-
string filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name
-
string filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
-
string flowClass - Filter the workflows by the given flow class. Accepted values are: edge, embedded, cloud, customNode, experience
-
string version - Return the workflow versions for the given version.
-
hash triggerFilter - Array of triggers to filter by - always filters against default flow version. (api.losant.com/#/definitions/flowTriggerFilter)
-
string includeCustomNodes - If the result of the request should also include the details of any custom nodes referenced by the returned workflows
-
hash query - Workflow filter JSON object which overrides the filterField, filter, triggerFilter, and flowClass parameters. (api.losant.com/#/definitions/advancedFlowByVersionQuery)
-
string losantdomain - Domain scope of request (rarely needed)
-
boolean _actions - Return resource actions in response
-
boolean _links - Return resource link in response
-
boolean _embedded - Return embedded resources in response
Responses:
-
200 - Collection of flow versions (api.losant.com/#/definitions/flowVersions)
Errors:
-
400 - Error if malformed request (api.losant.com/#/definitions/error)
-
404 - Error if application was not found (api.losant.com/#/definitions/error)
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/losant_rest/flows.rb', line 133 def get_by_version(params = {}) params = Utils.symbolize_hash_keys(params) query_params = { _actions: false, _links: true, _embedded: true } headers = {} body = nil raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId) raise ArgumentError.new("version is required") unless params.has_key?(:version) query_params[:sortField] = params[:sortField] if params.has_key?(:sortField) query_params[:sortDirection] = params[:sortDirection] if params.has_key?(:sortDirection) query_params[:page] = params[:page] if params.has_key?(:page) query_params[:perPage] = params[:perPage] if params.has_key?(:perPage) query_params[:filterField] = params[:filterField] if params.has_key?(:filterField) query_params[:filter] = params[:filter] if params.has_key?(:filter) query_params[:flowClass] = params[:flowClass] if params.has_key?(:flowClass) query_params[:version] = params[:version] if params.has_key?(:version) query_params[:triggerFilter] = params[:triggerFilter] if params.has_key?(:triggerFilter) query_params[:includeCustomNodes] = params[:includeCustomNodes] if params.has_key?(:includeCustomNodes) query_params[:query] = params[:query] if params.has_key?(:query) query_params[:query] = JSON.dump(query_params[:query]) if query_params.has_key?(:query) headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain) query_params[:_actions] = params[:_actions] if params.has_key?(:_actions) query_params[:_links] = params[:_links] if params.has_key?(:_links) query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded) path = "/applications/#{params[:applicationId]}/flows/version" @client.request( method: :get, path: path, query: query_params, headers: headers, body: body) end |
#import(params = {}) ⇒ Object
Import a set of flows and flow versions
Authentication: The client must be configured with a valid api access token to call this action. The token must include at least one of the following scopes: all.Application, all.Organization, all.User, flows.*, or flows.import.
Parameters:
-
string applicationId - ID associated with the application
-
hash importData - New flow and flow version information (api.losant.com/#/definitions/flowsImportPost)
-
string losantdomain - Domain scope of request (rarely needed)
-
boolean _actions - Return resource actions in response
-
boolean _links - Return resource link in response
-
boolean _embedded - Return embedded resources in response
Responses:
-
201 - Successfully imported workflows (api.losant.com/#/definitions/flowsImportResult)
Errors:
-
400 - Error if malformed request (api.losant.com/#/definitions/error)
-
404 - Error if application was not found (api.losant.com/#/definitions/error)
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 |
# File 'lib/losant_rest/flows.rb', line 191 def import(params = {}) params = Utils.symbolize_hash_keys(params) query_params = { _actions: false, _links: true, _embedded: true } headers = {} body = nil raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId) raise ArgumentError.new("importData is required") unless params.has_key?(:importData) body = params[:importData] if params.has_key?(:importData) headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain) query_params[:_actions] = params[:_actions] if params.has_key?(:_actions) query_params[:_links] = params[:_links] if params.has_key?(:_links) query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded) path = "/applications/#{params[:applicationId]}/flows/import" @client.request( method: :post, path: path, query: query_params, headers: headers, body: body) end |
#palette(params = {}) ⇒ Object
Gets additional nodes that should be available in the palette
Authentication: The client must be configured with a valid api access token to call this action. The token must include at least one of the following scopes: all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, flows.*, or flows.palette.
Parameters:
-
string applicationId - ID associated with the application
-
string losantdomain - Domain scope of request (rarely needed)
-
boolean _actions - Return resource actions in response
-
boolean _links - Return resource link in response
-
boolean _embedded - Return embedded resources in response
Responses:
-
200 - The additional nodes available in the palette (api.losant.com/#/definitions/paletteResponse)
Errors:
-
400 - Error if malformed request (api.losant.com/#/definitions/error)
-
404 - Error if application was not found (api.losant.com/#/definitions/error)
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
# File 'lib/losant_rest/flows.rb', line 237 def palette(params = {}) params = Utils.symbolize_hash_keys(params) query_params = { _actions: false, _links: true, _embedded: true } headers = {} body = nil raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId) headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain) query_params[:_actions] = params[:_actions] if params.has_key?(:_actions) query_params[:_links] = params[:_links] if params.has_key?(:_links) query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded) path = "/applications/#{params[:applicationId]}/flows/palette" @client.request( method: :get, path: path, query: query_params, headers: headers, body: body) end |
#post(params = {}) ⇒ Object
Create a new flow for an application
Authentication: The client must be configured with a valid api access token to call this action. The token must include at least one of the following scopes: all.Application, all.Organization, all.User, flows.*, or flows.post.
Parameters:
-
string applicationId - ID associated with the application
-
hash flow - New flow information (api.losant.com/#/definitions/flowPost)
-
string includeCustomNodes - If the result of the request should also include the details of any custom nodes referenced by the returned workflows
-
string losantdomain - Domain scope of request (rarely needed)
-
boolean _actions - Return resource actions in response
-
boolean _links - Return resource link in response
-
boolean _embedded - Return embedded resources in response
Responses:
-
201 - Successfully created flow (api.losant.com/#/definitions/flow)
Errors:
-
400 - Error if malformed request (api.losant.com/#/definitions/error)
-
404 - Error if application was not found (api.losant.com/#/definitions/error)
283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 |
# File 'lib/losant_rest/flows.rb', line 283 def post(params = {}) params = Utils.symbolize_hash_keys(params) query_params = { _actions: false, _links: true, _embedded: true } headers = {} body = nil raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId) raise ArgumentError.new("flow is required") unless params.has_key?(:flow) body = params[:flow] if params.has_key?(:flow) query_params[:includeCustomNodes] = params[:includeCustomNodes] if params.has_key?(:includeCustomNodes) headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain) query_params[:_actions] = params[:_actions] if params.has_key?(:_actions) query_params[:_links] = params[:_links] if params.has_key?(:_links) query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded) path = "/applications/#{params[:applicationId]}/flows" @client.request( method: :post, path: path, query: query_params, headers: headers, body: body) end |