chronicle-etl 0.2.0 → 0.2.1
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/chronicle/etl/loaders/loader.rb +1 -0
- data/lib/chronicle/etl/loaders/rest_loader.rb +30 -0
- data/lib/chronicle/etl/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d9be4b073385d9758a8b709bb6726d8dae648b8c4dbef474343840c011d1178
|
4
|
+
data.tar.gz: 0d95395407d37f7e322287a0920bba60e1b4f81eb8649190d021e13580604a2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 386c96518aa2d2810ae2a93bbe3af5bb08e26e132608b4e6ed8a278da076783e453854a2120c5016b6d02cd5dea406146d10ef3c7c1e77d854acd8ff2608eaf7
|
7
|
+
data.tar.gz: eb14402be5d6db44a6f06e6ec930acc5103b36e5c2e5a13e89137c9ee45f5f11c1e9e6ab13d4d44e6ee06bd9b02309e02ac33e81256645ef71d5b431c97eb199
|
data/Gemfile.lock
CHANGED
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
require 'uri'
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
module Chronicle
|
6
|
+
module ETL
|
7
|
+
class RestLoader < Chronicle::ETL::Loader
|
8
|
+
def initialize(options={})
|
9
|
+
super(options)
|
10
|
+
end
|
11
|
+
|
12
|
+
def load(result)
|
13
|
+
uri = URI.parse("#{@options[:hostname]}#{@options[:endpoint]}")
|
14
|
+
|
15
|
+
header = {
|
16
|
+
"Authorization" => "Bearer #{@options[:access_token]}",
|
17
|
+
"Content-Type": 'application/json'
|
18
|
+
}
|
19
|
+
|
20
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
21
|
+
request = Net::HTTP::Post.new(uri.request_uri, header)
|
22
|
+
|
23
|
+
obj = {data: result} unless result[:data]
|
24
|
+
request.body = obj.to_json
|
25
|
+
|
26
|
+
response = http.request(request)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chronicle-etl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Louis
|
@@ -189,6 +189,7 @@ files:
|
|
189
189
|
- lib/chronicle/etl/extractors/stdin_extractor.rb
|
190
190
|
- lib/chronicle/etl/loaders/csv_loader.rb
|
191
191
|
- lib/chronicle/etl/loaders/loader.rb
|
192
|
+
- lib/chronicle/etl/loaders/rest_loader.rb
|
192
193
|
- lib/chronicle/etl/loaders/stdout_loader.rb
|
193
194
|
- lib/chronicle/etl/loaders/table_loader.rb
|
194
195
|
- lib/chronicle/etl/runner.rb
|