mojito_import 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +22 -22
- data/changelog.md +3 -0
- data/lib/mojito_import/importer.rb +1 -1
- data/lib/mojito_import/session.rb +27 -0
- data/lib/mojito_import/version.rb +1 -1
- data/lib/mojito_import.rb +1 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f1b2abb1bf2d64aeec53cd821b2252e347676efa91c3d70c3e41a75a0b1d05f
|
4
|
+
data.tar.gz: bc39366394d3356484a3a4469306e36397fa7a4b6e95835c08b68cef220b8d97
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 177b8db20f9cb273bd1e58cfefd98a3ccfd420ea8f9c876ae5250735900016e98a1212099b0988f3438d80d028d9df84954501ebc472e37992bcb40563e4301f
|
7
|
+
data.tar.gz: '08558abc4b0110540bb0d796ade2bb70dc330f8c728c1fd3fb8ba90408261676f3470bc676105e53bd3bf6b527665602b2ea34c58247f9b3f584fb691f02963a'
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
mojito_import (0.
|
4
|
+
mojito_import (0.7.0)
|
5
5
|
rest-client (~> 2.0)
|
6
6
|
|
7
7
|
GEM
|
@@ -9,11 +9,11 @@ GEM
|
|
9
9
|
specs:
|
10
10
|
coderay (1.1.2)
|
11
11
|
diff-lcs (1.3)
|
12
|
-
domain_name (0.5.
|
12
|
+
domain_name (0.5.20190701)
|
13
13
|
unf (>= 0.0.5, < 1.0.0)
|
14
14
|
ffi (1.11.1)
|
15
15
|
formatador (0.2.5)
|
16
|
-
guard (2.
|
16
|
+
guard (2.16.1)
|
17
17
|
formatador (>= 0.2.4)
|
18
18
|
listen (>= 2.7, < 4.0)
|
19
19
|
lumberjack (>= 1.0.12, < 2.0)
|
@@ -22,17 +22,17 @@ GEM
|
|
22
22
|
pry (>= 0.9.12)
|
23
23
|
shellany (~> 0.0)
|
24
24
|
thor (>= 0.18.1)
|
25
|
+
http-accept (1.7.0)
|
25
26
|
http-cookie (1.0.3)
|
26
27
|
domain_name (~> 0.5)
|
27
|
-
listen (3.
|
28
|
-
rb-fsevent (~> 0.
|
29
|
-
rb-inotify (~> 0.9, >= 0.9.
|
30
|
-
ruby_dep (~> 1.2)
|
28
|
+
listen (3.2.0)
|
29
|
+
rb-fsevent (~> 0.10, >= 0.10.3)
|
30
|
+
rb-inotify (~> 0.9, >= 0.9.10)
|
31
31
|
lumberjack (1.0.13)
|
32
32
|
method_source (0.9.2)
|
33
|
-
mime-types (3.
|
33
|
+
mime-types (3.3.1)
|
34
34
|
mime-types-data (~> 3.2015)
|
35
|
-
mime-types-data (3.2019.
|
35
|
+
mime-types-data (3.2019.1009)
|
36
36
|
nenv (0.3.0)
|
37
37
|
netrc (0.11.0)
|
38
38
|
notiffany (0.1.3)
|
@@ -45,24 +45,24 @@ GEM
|
|
45
45
|
rb-fsevent (0.10.3)
|
46
46
|
rb-inotify (0.10.0)
|
47
47
|
ffi (~> 1.0)
|
48
|
-
rest-client (2.0
|
48
|
+
rest-client (2.1.0)
|
49
|
+
http-accept (>= 1.7.0, < 2.0)
|
49
50
|
http-cookie (>= 1.0.2, < 2.0)
|
50
51
|
mime-types (>= 1.16, < 4.0)
|
51
52
|
netrc (~> 0.8)
|
52
|
-
rspec (3.
|
53
|
-
rspec-core (~> 3.
|
54
|
-
rspec-expectations (~> 3.
|
55
|
-
rspec-mocks (~> 3.
|
56
|
-
rspec-core (3.
|
57
|
-
rspec-support (~> 3.
|
58
|
-
rspec-expectations (3.
|
53
|
+
rspec (3.9.0)
|
54
|
+
rspec-core (~> 3.9.0)
|
55
|
+
rspec-expectations (~> 3.9.0)
|
56
|
+
rspec-mocks (~> 3.9.0)
|
57
|
+
rspec-core (3.9.0)
|
58
|
+
rspec-support (~> 3.9.0)
|
59
|
+
rspec-expectations (3.9.0)
|
59
60
|
diff-lcs (>= 1.2.0, < 2.0)
|
60
|
-
rspec-support (~> 3.
|
61
|
-
rspec-mocks (3.
|
61
|
+
rspec-support (~> 3.9.0)
|
62
|
+
rspec-mocks (3.9.0)
|
62
63
|
diff-lcs (>= 1.2.0, < 2.0)
|
63
|
-
rspec-support (~> 3.
|
64
|
-
rspec-support (3.
|
65
|
-
ruby_dep (1.5.0)
|
64
|
+
rspec-support (~> 3.9.0)
|
65
|
+
rspec-support (3.9.0)
|
66
66
|
shellany (0.0.1)
|
67
67
|
thor (0.20.3)
|
68
68
|
unf (0.1.4)
|
data/changelog.md
CHANGED
@@ -55,7 +55,7 @@ module MojitoImport
|
|
55
55
|
# RestClient::Resource.new( , verify_ssl: false, log: Logger.new(STDOUT)).post "https://mojito-import.test/api/v1/new_import", data.to_json, {content_type: :json, accept: :json, :Authorization => "Bearer #{access_token}"}
|
56
56
|
|
57
57
|
remote_endpoint_url = "#{mojito_host}/api/v1/new_import"
|
58
|
-
|
58
|
+
Rails.logger.debug { "will contact : #{remote_endpoint_url}"}
|
59
59
|
RestClient::Resource.new( remote_endpoint_url, verify_ssl: false, log: Logger.new(STDOUT)).post data.to_json, {content_type: :json, accept: :json, :Authorization => "Bearer #{access_token}"}
|
60
60
|
end
|
61
61
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require "rest-client"
|
2
|
+
module MojitoImport
|
3
|
+
class Session
|
4
|
+
|
5
|
+
|
6
|
+
def self.get_token(import_scenario_identifier, import_session_token, session_bucket, use_dev_host: false)
|
7
|
+
data = { import_scenario_identifier: import_scenario_identifier, session_bucket: session_bucket }
|
8
|
+
|
9
|
+
mojito_host = use_dev_host ? 'http://www.mojito-import.test' : 'https://www.mojito-import.com'
|
10
|
+
|
11
|
+
request = RestClient::Resource.new(mojito_host, accept: :json,content_type: :json, Authorization: "Bearer #{import_session_token}", verify_ssl: false)
|
12
|
+
|
13
|
+
response = request["api/v1/import_session_token?access_token=#{import_session_token}"].post(data) { |response, request, result|
|
14
|
+
case response.code
|
15
|
+
when 200, 201
|
16
|
+
return JSON.parse(response)["token"]
|
17
|
+
when 500
|
18
|
+
return {"error when retrieving token" => response.body.inspect}
|
19
|
+
else
|
20
|
+
return JSON.parse(response)
|
21
|
+
end
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
data/lib/mojito_import.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mojito_import
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Darde
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -103,6 +103,7 @@ files:
|
|
103
103
|
- lib/mojito_import.rb
|
104
104
|
- lib/mojito_import/importer.rb
|
105
105
|
- lib/mojito_import/report.rb
|
106
|
+
- lib/mojito_import/session.rb
|
106
107
|
- lib/mojito_import/version.rb
|
107
108
|
- mojito_import.gemspec
|
108
109
|
homepage: https://www.mojito-import.com
|
@@ -127,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
128
|
- !ruby/object:Gem::Version
|
128
129
|
version: '0'
|
129
130
|
requirements: []
|
130
|
-
rubygems_version: 3.
|
131
|
+
rubygems_version: 3.1.2
|
131
132
|
signing_key:
|
132
133
|
specification_version: 4
|
133
134
|
summary: Mojito Import, so fresh.
|