ree_lib 1.0.46 → 1.0.48

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c891f66e5e8dfeb011588bb1cdfebebd2d1ca88552a2e623eeb573d72b43fd47
4
- data.tar.gz: 3c9885f0abfb06dc1cde8d9fcdcb7a5901c859dbb629c61d7939caf1eb74b242
3
+ metadata.gz: 384e6a3160a97c4246e496a4b89dc3e9a7ab9f145f08c089ef317108681a2f8b
4
+ data.tar.gz: 446044926129ddf07b7e4fad340a358937669e64655fe01be630aaaaabc24a62
5
5
  SHA512:
6
- metadata.gz: '0726859940ca7bc5e7f32a1995ad40f42670cc41a3c829d5211b37712ef65092efb5a643cd0b000d55f1497fd4db2fa37eee991cb7e5f27185515d6f3f996cc7'
7
- data.tar.gz: fed4151d293502fbf5eb73236acf2e944f3ceade748d7e73da38bbf3cf906df1153388789db47c11469c005a06fb7a79eca8736e55e0d496f1a2df252bde6047
6
+ metadata.gz: e9ee7723045997261aec463595c3b5e0c8f27cc0c9990fd4a0feb0e674df2407f6d1f2db7a4e36bbdedba6e939e33d6e4ba62e9fbe1197049f539f3f0171abc5
7
+ data.tar.gz: f1ca42566bf57f1e20eb22a55b94273d566d17db2730f8c4443acdec65ae0825a4e7e649e76de9853bd9381e553ee0a1dd2c254527b863f3d85f0c4d9562bac9
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ree_lib (1.0.46)
4
+ ree_lib (1.0.48)
5
5
  binding_of_caller (~> 1.0.0)
6
6
  i18n (~> 1.12.0)
7
7
  loofah (~> 2.18.0)
@@ -36,8 +36,6 @@ GEM
36
36
  crass (~> 1.0.2)
37
37
  nokogiri (>= 1.5.9)
38
38
  msgpack (1.6.0)
39
- nokogiri (1.14.3-x86_64-darwin)
40
- racc (~> 1.4)
41
39
  nokogiri (1.14.3-x86_64-linux)
42
40
  racc (~> 1.4)
43
41
  oj (3.13.23)
@@ -4,10 +4,8 @@ class ReeHttp::BuildRequest
4
4
  include Ree::FnDSL
5
5
 
6
6
  fn :build_request do
7
- link :to_json, from: :ree_json
8
- link :slice, from: :ree_hash
9
7
  link :not_blank, from: :ree_object
10
-
8
+ link :to_json, from: :ree_json
11
9
  link 'ree_http/constants', -> {
12
10
  HTTPS & HTTP & HTTPS_PORT & HTTP_PORT & DEFAULT_FORCE_SSL
13
11
  }
@@ -84,8 +82,8 @@ class ReeHttp::BuildRequest
84
82
 
85
83
  unless opts[:body].nil?
86
84
  request.body =
87
- case request[:body]
88
- when Hash then to_json[opts[:body]]
85
+ case opts[:body]
86
+ when Hash then to_json(opts[:body])
89
87
  when File then opts[:body].read
90
88
  else
91
89
  opts[:body]
@@ -41,14 +41,6 @@
41
41
 
42
42
  ]
43
43
  },
44
- {
45
- "target": "slice",
46
- "package_name": "ree_hash",
47
- "as": "slice",
48
- "imports": [
49
-
50
- ]
51
- },
52
44
  {
53
45
  "target": "to_json",
54
46
  "package_name": "ree_json",
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  require 'webmock/rspec'
3
+ require "tempfile"
3
4
 
4
5
  RSpec.describe :http_post do
5
6
  link :http_post, from: :ree_http
@@ -70,6 +71,26 @@ RSpec.describe :http_post do
70
71
  body: "abc"
71
72
  )
72
73
 
74
+ http_post(
75
+ host,
76
+ body: { foo: "bar" }
77
+ )
78
+ expect(WebMock).to have_requested(:post, host).with(body: "{\"foo\":\"bar\"}")
79
+
80
+ begin
81
+ tempfile = Tempfile.new
82
+ tempfile.write("hello world")
83
+ tempfile.rewind
84
+
85
+ http_post(
86
+ host,
87
+ body: File.open(tempfile.path)
88
+ )
89
+ expect(WebMock).to have_requested(:post, host).with(body: "hello world")
90
+ ensure
91
+ tempfile&.close!
92
+ end
93
+
73
94
  # works !
74
95
  # response = http_post(
75
96
  # 'http://127.0.0.1:8085/end',
@@ -78,9 +78,6 @@ class Roda
78
78
  r.instance_exec(@_request, route.warden_scope, &r.scope.opts[:ree_routes_before])
79
79
  end
80
80
 
81
- # TODO: implement me when migration to roda DSL happens
82
- # if route.before; end
83
-
84
81
  params = r.params
85
82
 
86
83
  if r.body
@@ -149,8 +146,10 @@ class Roda
149
146
  r.instance_exec(r, &child_proc)
150
147
  end
151
148
 
152
- route_procs.each do |route_proc|
153
- r.instance_exec(r, &route_proc)
149
+ r.is do
150
+ route_procs.each do |route_proc|
151
+ r.instance_exec(r, &route_proc)
152
+ end
154
153
  end
155
154
 
156
155
  nil
@@ -163,8 +162,10 @@ class Roda
163
162
  r.instance_exec(r, &child_proc)
164
163
  end
165
164
 
166
- route_procs.each do |route_proc|
167
- r.instance_exec(r, &route_proc)
165
+ r.is do
166
+ route_procs.each do |route_proc|
167
+ r.instance_exec(r, &route_proc)
168
+ end
168
169
  end
169
170
 
170
171
  nil
@@ -179,16 +180,20 @@ class Roda
179
180
  r.params[route_part] = param_val
180
181
  end
181
182
 
182
- route_procs.each do |route_proc|
183
- r.instance_exec(r, &route_proc)
183
+ r.is do
184
+ route_procs.each do |route_proc|
185
+ r.instance_exec(r, &route_proc)
186
+ end
184
187
  end
185
188
 
186
189
  nil
187
190
  end
188
191
  else
189
192
  r.is route_parts[0] do
190
- route_procs.each do |route_proc|
191
- r.instance_exec(r, &route_proc)
193
+ r.is do
194
+ route_procs.each do |route_proc|
195
+ r.instance_exec(r, &route_proc)
196
+ end
192
197
  end
193
198
 
194
199
  nil
@@ -93,19 +93,23 @@ class ReeRoda::BuildRoutingTree
93
93
  print_proc_tree(child)
94
94
  end
95
95
 
96
+ puts "#{get_offset(tree.depth + 1)}r.is do"
96
97
  tree.routes.each do |route|
97
- puts "#{get_offset(tree.depth + 1)}r.#{route.request_method} do"
98
- puts "#{get_offset(tree.depth + 1)}end"
98
+ puts "#{get_offset(tree.depth + 2)}r.#{route.request_method} do"
99
+ puts "#{get_offset(tree.depth + 2)}end"
99
100
  end
101
+ puts "#{get_offset(tree.depth + 1)}end"
100
102
 
101
103
  puts "#{get_offset(tree.depth)}end"
102
104
  else
103
105
  puts "#{get_offset(tree.depth)}r.is #{param_value} do"
104
106
 
107
+ puts "#{get_offset(tree.depth + 1)}r.is do"
105
108
  tree.routes.each do |route|
106
- puts "#{get_offset(tree.depth + 1)}r.#{route.request_method} do"
107
- puts "#{get_offset(tree.depth + 1)}end"
109
+ puts "#{get_offset(tree.depth + 2)}r.#{route.request_method} do"
110
+ puts "#{get_offset(tree.depth + 2)}end"
108
111
  end
112
+ puts "#{get_offset(tree.depth + 1)}end"
109
113
 
110
114
  puts "#{get_offset(tree.depth)}end"
111
115
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ReeLib
4
- VERSION = "1.0.46"
4
+ VERSION = "1.0.48"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ree_lib
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.46
4
+ version: 1.0.48
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ruslan Gatiyatov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-05-10 00:00:00.000000000 Z
11
+ date: 2023-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ree