batchly-sdk 0.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,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9478b8678d7cbf01eadc1a13efb0a8cdd16c1011
4
+ data.tar.gz: aa728e723f1c612650a73dade9396cfe12aba993
5
+ SHA512:
6
+ metadata.gz: bc805adb475825c730deb7a287359b98f0e933ade9b13a8b04a7410a216bced7005e5c511a95799531a026b081b2058ea528a29bafd72c316f51cd2aeec85f18
7
+ data.tar.gz: 349f2155b6e0621572ef3573aced79ca66441425d08f8d1419752e9b2442df6d744cc65deed7951f075504718cc15722a78571926d75e1375102aa36147a1237
@@ -0,0 +1,30 @@
1
+ require_relative 'batchly-sdk/iprocessor'
2
+
3
+ require_relative 'batchly-sdk/request/irequest'
4
+ require_relative 'batchly-sdk/request/db_request'
5
+ require_relative 'batchly-sdk/request/file_request'
6
+ require_relative 'batchly-sdk/request/queue_request'
7
+ require_relative 'batchly-sdk/request/delimited_request'
8
+
9
+ require_relative 'batchly-sdk/response/iresponse'
10
+ require_relative 'batchly-sdk/response/default_response'
11
+ require_relative 'batchly-sdk/response/file_response'
12
+ require_relative 'batchly-sdk/response/db_response'
13
+
14
+ ##
15
+ # Batchly SDK is a service provider interface offered to create processors for use in batchly
16
+ # http://www.batchly.net
17
+ module Batchly
18
+
19
+ ##
20
+ # All request types that batchly supports for different data sources are available as part of this module
21
+ # Currently supports QueueRequest, FileRequest, DelimitedRequest and DbRequest
22
+ module Request
23
+ end
24
+
25
+ ##
26
+ # All response types that batchly supports for different data destinations are available as part of this module
27
+ # Currently supports DefaultResponse, FileResponse and DbResponse
28
+ module Response
29
+ end
30
+ end
@@ -0,0 +1,36 @@
1
+ require_relative "request/irequest"
2
+
3
+ module Batchly
4
+
5
+ ##
6
+ # This is the basic interface for implementation of a processor. The name of the class is IProcessor to keep it compliant with other language sdk.
7
+ # Ruby doesn't support interfaces and so this base abstract class needs to be extended to write a new processor
8
+ class IProcessor
9
+ ##
10
+ # Process method should be implemented in a stateless manner to ensure fault tolerance.
11
+ # Once implemented, all the files along with necessary dependencies should be compressed into a zip folder and uploaded into batchly portal to create a new processor.
12
+ # While uploading the processor, you need to configure the right request/response parameters for ensuring the right bootstrapping during operations.
13
+ # You can consider the parameters as Idempotent as long as you configure the same on portal. The parameters will be assigned automatically during Job run.
14
+ #
15
+ #
16
+ # Supports the following implementations.
17
+ #
18
+ # 1. QueueRequest - The unique identifier for UoW will be assigned and sent to processor. Actual usage is completely within the processor Implementation.
19
+ # 2. FileRequest - Built for file storage input sources. The file would be downloaded from storage and saved to local disk.
20
+ # 3. DelimitedFileRequest - Built for file storage input sources.
21
+ # 4. DbRequest - Records would be retrieved from the give database/table connectionString
22
+ # </param>
23
+ # <returns>
24
+ #
25
+ # Supports the following implementations.
26
+ #
27
+ # 1. DefaultResponse - Share the status of your processing.
28
+ # 2. FileResponse - Built for file storage output. Allows processor to share the location of response files that need to be saved to storage.
29
+ # 3. DbResponse - updates the database for the process input TableDataRequest record.
30
+ #
31
+ # </returns>
32
+ def process(request)
33
+ raise 'this method should be overriden and return the IResponse object'
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,36 @@
1
+ require_relative 'irequest'
2
+
3
+ module Batchly
4
+ module Request
5
+
6
+ ##
7
+ # DbRequest is a type of request that supports relational data sources
8
+ # Request holds the base data and source connection string
9
+ class DbRequest < IRequest
10
+
11
+ def initialize(id = nil, parameters = nil, connection_string = nil, data = nil, content_path = nil)
12
+ @id = id
13
+ @parameters = parameters
14
+ @connection_string = connection_string
15
+ @data = data
16
+ @content_path = content_path
17
+ end
18
+
19
+ # id for the Unit of Work +string+
20
+ attr_accessor :id
21
+
22
+ # Values for parameters configured via UI +hashTable+
23
+ attr_accessor :parameters
24
+
25
+ # connection string +string+
26
+ attr_accessor :connection_string
27
+
28
+ # dataset of data required to process unit of work. +hashTable+
29
+ # If the configured query returns multiple record sets, each record set is a table within the dataset.
30
+ attr_accessor :data
31
+
32
+ # Path for loading additional content - Path to container from where code is executed +string+
33
+ attr_accessor :content_path
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,34 @@
1
+ require_relative 'irequest'
2
+
3
+ module Batchly
4
+ module Request
5
+
6
+ ##
7
+ # DelimitedFileRequest is a type of request that supports csv and other delmited type of source files
8
+ # Request holds the fields as an array. The fields are column values from a single row
9
+ class DelimitedFileRequest < IRequest
10
+
11
+ def initialize(id = nil, parameters = nil, fields = nil, content_path = nil)
12
+ @id = id
13
+ @parameters = parameters
14
+ @fields = fields
15
+ @content_path = content_path
16
+ end
17
+
18
+ # Unique id of the Unit of Work +string+
19
+ attr_accessor :id
20
+
21
+ # parameters that has been configured in portal +hashTable+
22
+ attr_accessor :parameters
23
+
24
+ # Fields contain the individual columns of a delimited row +array+
25
+ attr_accessor :fields
26
+
27
+
28
+ # Path for loading additional content - Path to container from where code is executed +string+
29
+ attr_accessor :content_path
30
+
31
+ end
32
+
33
+ end
34
+ end
@@ -0,0 +1,30 @@
1
+ require_relative 'irequest'
2
+
3
+ module Batchly
4
+ module Request
5
+ ##
6
+ # FileRequest is a type of request that supports file storage
7
+ # Request holds the location of the file thats available for your processing
8
+ class FileRequest < IRequest
9
+
10
+ def initialize(id = nil, parameters = nil, location = nil, content_path = nil )
11
+ @id = id
12
+ @parameters = parameters
13
+ @location = location
14
+ @content_path = content_path
15
+ end
16
+
17
+ # Unique id of the Unit of Work +string+
18
+ attr_accessor :id
19
+
20
+ # parameters that has been configured in portal +hashTable+
21
+ attr_accessor :parameters
22
+
23
+ # Location of the file on disk +string+
24
+ attr_accessor :location
25
+
26
+ # Path for loading additional content - Path to container from where code is executed +string+
27
+ attr_accessor :content_path
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,21 @@
1
+
2
+ module Batchly
3
+ module Request
4
+
5
+ ##
6
+ # IRequest is the base interface for all request types
7
+ # Use the actual implementations while duck typing - File, Delimited, Db or Queue
8
+ class IRequest
9
+
10
+ # id for the Unit of Work +string+
11
+ attr_accessor :id
12
+
13
+ # Values for parameters configured via UI +hashTable+
14
+ attr_accessor :parameters
15
+
16
+ # Current working directory +string+
17
+ attr_accessor :content_path
18
+
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,33 @@
1
+ require_relative 'irequest'
2
+ require 'json'
3
+
4
+ module Batchly
5
+ module Request
6
+
7
+ ##
8
+ # QueueRequest is a type of request that supports pub/sub or queue sources
9
+ # Request holds the content of a single message
10
+ class QueueRequest < IRequest
11
+
12
+ def initialize(id = nil, parameters = nil, content = nil, content_path = nil )
13
+ @id = id
14
+ @parameters = parameters
15
+ @content = content
16
+ @content_path = content_path
17
+ end
18
+
19
+ # id for the Unit of Work +string+
20
+ attr_accessor :id
21
+
22
+ # Values for parameters configured via UI +hashTable+
23
+ attr_accessor :parameters
24
+
25
+ # Path for content +string+
26
+ attr_accessor :content
27
+
28
+ # Path for loading additional content - Path to container from where code is executed +string+
29
+ attr_accessor :content_path
30
+
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,25 @@
1
+ require_relative 'iresponse'
2
+
3
+ module Batchly
4
+ module Response
5
+
6
+ ##
7
+ # The DbResponse is a type of response when you want batchly to execute queries on destination database
8
+ class DbResponse < IResponse
9
+
10
+ # Unique id of the Unit of Work +string+
11
+ attr_accessor :id
12
+
13
+ # Status of the processing +boolean+
14
+ attr_accessor :is_processing_success
15
+
16
+ # Parameter Name and Data pair for each parameter of the SQL Query that is run on successful processing +hashTable+
17
+ # The query is configured as part of Batchly Portal and is run in sequence to ensure successful writes to the database.
18
+ attr_accessor :parameter_values
19
+
20
+ # Duplicate message that can be deleted without any post processing +boolean+
21
+ attr_accessor :is_duplicate
22
+
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,24 @@
1
+ require_relative 'iresponse'
2
+
3
+ module Batchly
4
+ module Response
5
+
6
+ ##
7
+ # This is the minimal response to return when the processing doesn't generate any output that requires processing by batchly agent
8
+ # The *is_processing_success* represents status of processing. +boolean+ _true_ for success and _false_ for failure
9
+ # The *is_duplicate* field represents duplicate tracking if state is managed by processor.
10
+ # The *id* should equal the request id
11
+ class DefaultResponse < IResponse
12
+
13
+ # Unique id of the Unit of Work +string+
14
+ attr_accessor :id
15
+
16
+ # Status of the processing +boolean+
17
+ attr_accessor :is_processing_success
18
+
19
+ # Duplicate message that can be deleted without any post processing +boolean+
20
+ attr_accessor :is_duplicate
21
+ end
22
+
23
+ end
24
+ end
@@ -0,0 +1,29 @@
1
+ require_relative 'iresponse'
2
+
3
+ module Batchly
4
+ module Response
5
+
6
+ ##
7
+ # FileResponse is the type of response to return when you generate a file output
8
+ # Batchly Agent automatically takes the output file and sends it to the right destination(s)
9
+ # The destinations are configured from the portal and is processor independent
10
+ # Destinations are attached at the Job Level. The processor is reusable across many jobs without knowing the source and destination
11
+ class FileResponse < IResponse
12
+
13
+ # Unique id of the Unit of Work +string+
14
+ attr_accessor :id
15
+
16
+ # Status of the processing +boolean+
17
+ attr_accessor :is_processing_success
18
+
19
+ # locations of the ouptut files on disk +Array+
20
+ # One full path per output file. Disk File Name is used as file name for response.
21
+ # E.g.:- C:\Processed\Output\File1.png - Saved to storage as File.Png
22
+ attr_accessor :locations
23
+
24
+ # Duplicate message that can be deleted without any post processing +boolean+
25
+ attr_accessor :is_duplicate
26
+
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,24 @@
1
+ module Batchly
2
+ module Response
3
+
4
+ ##
5
+ # This is the basic interface for returning the values post processing
6
+ # Use the implemented classes for returning the right type of bootstrapping by the batchly agent
7
+ # Supported implementations are:-
8
+ # * DefaultResponse
9
+ # * FileResponse
10
+ # * DbResponse
11
+ class IResponse
12
+
13
+ # Unique id of the Unit of Work
14
+ attr_accessor :id
15
+
16
+ # Status of the processing
17
+ attr_accessor :is_processing_success
18
+
19
+ # Duplicate message that can be deleted without any post processing
20
+ attr_accessor :is_duplicate
21
+
22
+ end
23
+ end
24
+ end
metadata ADDED
@@ -0,0 +1,54 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: batchly-sdk
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.3
5
+ platform: ruby
6
+ authors:
7
+ - Batchly Tech Team
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-09-08 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A simple interface for writing new processors for using batchly
14
+ email: support@batchly.net
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/batchly-sdk.rb
20
+ - lib/batchly-sdk/iprocessor.rb
21
+ - lib/batchly-sdk/request/db_request.rb
22
+ - lib/batchly-sdk/request/delimited_request.rb
23
+ - lib/batchly-sdk/request/file_request.rb
24
+ - lib/batchly-sdk/request/irequest.rb
25
+ - lib/batchly-sdk/request/queue_request.rb
26
+ - lib/batchly-sdk/response/db_response.rb
27
+ - lib/batchly-sdk/response/default_response.rb
28
+ - lib/batchly-sdk/response/file_response.rb
29
+ - lib/batchly-sdk/response/iresponse.rb
30
+ homepage: http://www.batchly.net
31
+ licenses:
32
+ - Proprietary
33
+ metadata: {}
34
+ post_install_message:
35
+ rdoc_options: []
36
+ require_paths:
37
+ - lib
38
+ required_ruby_version: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 2.0.0.pre.p647
43
+ required_rubygems_version: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ requirements: []
49
+ rubyforge_project:
50
+ rubygems_version: 2.4.5.1
51
+ signing_key:
52
+ specification_version: 4
53
+ summary: Batchly Processor SDK
54
+ test_files: []