lucid_http 1.1.1 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -5
- data/lib/lucid_http/version.rb +1 -1
- data/lib/lucid_http.rb +28 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 287afdfaab49512baae00210dd80789f2099661ac15916f426d33f5935df5325
|
4
|
+
data.tar.gz: 5efff8a706349a1dcce94769b5cf242c1de4ab43a08d746b45b952abe38ef8ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6afec6436d0feef35b2dbe657e6e0398999512667c884015ac38e8d12336e8c59cc45f85386b906604369b05ad3be4298c5ee3158ac146b64aebbef7054feae5
|
7
|
+
data.tar.gz: cfcb9262ec8c6d631cc4b1eed9c3cab649b092783cfa40aabdb3441dc4bca4994be3fb2d0ee7a7907357984381994c8f9949a6afdabc0b0de998e09fc8fc0815
|
data/README.md
CHANGED
@@ -6,7 +6,11 @@ TODO: Delete this and the text above, and describe your gem
|
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
9
|
-
|
9
|
+
The rocommended way to install lucid_http is by running
|
10
|
+
|
11
|
+
$ gem install lucid_http
|
12
|
+
|
13
|
+
You could also add it to your application's Gemfile, but this gem is not meant to be used in this way:
|
10
14
|
|
11
15
|
```ruby
|
12
16
|
gem 'lucid_http'
|
@@ -16,10 +20,6 @@ And then execute:
|
|
16
20
|
|
17
21
|
$ bundle
|
18
22
|
|
19
|
-
Or install it yourself as:
|
20
|
-
|
21
|
-
$ gem install lucid_http
|
22
|
-
|
23
23
|
## Usage
|
24
24
|
|
25
25
|
An explanation of the usage for this gem is on the book Mastering Roda, you can follow [this link](https://fiachetti.gitlab.io/mastering-roda/#a-quick-introduction-to-lucid_http) to find it
|
data/lib/lucid_http/version.rb
CHANGED
data/lib/lucid_http.rb
CHANGED
@@ -5,11 +5,25 @@ require "lucid_http/formatters"
|
|
5
5
|
require "lucid_http/response"
|
6
6
|
|
7
7
|
module LucidHttp
|
8
|
+
def self.base_url
|
9
|
+
@base_url || "http://localhost:9292"
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.base_url=(new_base_url)
|
13
|
+
@base_url = new_base_url
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.reset_default_base_url!
|
17
|
+
self.base_url = nil
|
18
|
+
end
|
19
|
+
|
8
20
|
class Client
|
9
|
-
|
21
|
+
def initialize(base_url: ENV.fetch("LUCID_HTTP_BASE_URL"))
|
22
|
+
LucidHttp.base_url = base_url
|
23
|
+
end
|
10
24
|
|
11
|
-
def
|
12
|
-
|
25
|
+
def base_url
|
26
|
+
LucidHttp.base_url
|
13
27
|
end
|
14
28
|
|
15
29
|
%i[get post put patch delete options].each do |verb|
|
@@ -43,30 +57,34 @@ end
|
|
43
57
|
end
|
44
58
|
end
|
45
59
|
|
60
|
+
def response
|
61
|
+
@__response
|
62
|
+
end
|
63
|
+
|
46
64
|
def body
|
47
|
-
|
65
|
+
response.body
|
48
66
|
end
|
49
67
|
|
50
68
|
def verb
|
51
|
-
|
69
|
+
response.verb
|
52
70
|
end
|
53
71
|
|
54
72
|
def status
|
55
|
-
|
73
|
+
response.status
|
56
74
|
end
|
57
75
|
|
58
76
|
def content_type
|
59
|
-
|
77
|
+
response.content_type
|
60
78
|
end
|
61
79
|
|
62
80
|
def url
|
63
|
-
|
81
|
+
response.url
|
64
82
|
end
|
65
83
|
|
66
84
|
def path
|
67
|
-
|
85
|
+
response.path
|
68
86
|
end
|
69
87
|
|
70
88
|
def error
|
71
|
-
|
89
|
+
response.error
|
72
90
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lucid_http
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Federico Iachetti
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-04-
|
11
|
+
date: 2023-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|