bormashino 0.1.2 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bormashino/fetch.rb +39 -0
- data/lib/bormashino/server.rb +4 -0
- data/lib/bormashino/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f967c70309ac21c13ea5ea3bf3e17c1de6eabea2c7710171bef2cab8e79c26f
|
4
|
+
data.tar.gz: 26b96106a7464d6e999545ed012eaf3fc3ca3dd182e6a308d22dbb6f450a3448
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0e96a44588a9fc35067ff4117eaee65f4181315c164857f46ad3218afdd987bdc895b9402569f2730c3b125b8a6beaccfc0327c066fe04b63451e1cb083de61
|
7
|
+
data.tar.gz: a11375871333d6fe5d849d32a71c0a87ad501e6487746aae270de50dc834e04bf6682872efd57e91a138ecbdfed6a6db0e77eab1ee8f775a9bf7cf33e5f85dc8
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'js'
|
2
|
+
require_relative 'ext/js'
|
3
|
+
require 'cgi'
|
4
|
+
|
5
|
+
module Bormashino
|
6
|
+
class Fetch
|
7
|
+
attr_accessor :resource, :init, :resolved_to, :options
|
8
|
+
|
9
|
+
def initialize(resource:, resolved_to:, init: {}, options: {})
|
10
|
+
@resource = resource
|
11
|
+
@init = init
|
12
|
+
@resolved_to = resolved_to
|
13
|
+
@options = options
|
14
|
+
end
|
15
|
+
|
16
|
+
def run
|
17
|
+
raise 'No mounted apps' unless Bormashino::Server.mounted?
|
18
|
+
|
19
|
+
# rubocop:disable Style::DocumentDynamicEvalDefinition
|
20
|
+
JS.eval <<-ENDOFEVAL
|
21
|
+
fetch(
|
22
|
+
#{@resource.to_json},
|
23
|
+
#{@init.to_json}
|
24
|
+
).then((r) => {
|
25
|
+
r.text().then((t) => {
|
26
|
+
window.bormashino.request(
|
27
|
+
'post',
|
28
|
+
#{@resolved_to.to_json},
|
29
|
+
'status=' + r.status +
|
30
|
+
'&payload=' + encodeURIComponent(t) +
|
31
|
+
'&options=' + #{CGI.escape(@options.to_json).to_json}
|
32
|
+
)
|
33
|
+
})
|
34
|
+
})
|
35
|
+
ENDOFEVAL
|
36
|
+
# rubocop:enable Style::DocumentDynamicEvalDefinition
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/lib/bormashino/server.rb
CHANGED
data/lib/bormashino/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bormashino
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kenichiro Yasuda
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-05-
|
11
|
+
date: 2022-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json_pure
|
@@ -72,6 +72,7 @@ files:
|
|
72
72
|
- README.md
|
73
73
|
- lib/bormashino.rb
|
74
74
|
- lib/bormashino/ext/js.rb
|
75
|
+
- lib/bormashino/fetch.rb
|
75
76
|
- lib/bormashino/local_storage.rb
|
76
77
|
- lib/bormashino/mock/local_storage.rb
|
77
78
|
- lib/bormashino/server.rb
|