lucid_http 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -6
- data/lib/lucid_http/response.rb +1 -1
- data/lib/lucid_http/version.rb +1 -1
- data/lib/lucid_http.rb +24 -10
- data/lucid_http.gemspec +3 -1
- metadata +33 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5eb49e10f0ed93581bd12e4c0855d540df34aad9f06b16ef998ea61829083f3
|
4
|
+
data.tar.gz: 922b6745441867819c4a766ea45491338c5f0d8c63be8936b85b74fd79eb4445
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f2f53e389652a8f76670d1a8fbe687460cffb7b1dbd67a05ddfd7a5d975247d7e01a328901c8250afbb575236d7bf2780a90e4cbd63137daed265fe5cec2c22
|
7
|
+
data.tar.gz: 19f08bb2b81fdb437fe4eb808643ab412d60861bc2f88e8b7d3583ceebe39c89efa4c786addaae924f01814b4c0cc7a76f7060ac6a5818548635a746437c536b
|
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,13 +20,9 @@ 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
|
26
26
|
|
27
27
|
## Development
|
28
28
|
|
data/lib/lucid_http/response.rb
CHANGED
data/lib/lucid_http/version.rb
CHANGED
data/lib/lucid_http.rb
CHANGED
@@ -5,11 +5,21 @@ require "lucid_http/formatters"
|
|
5
5
|
require "lucid_http/response"
|
6
6
|
|
7
7
|
module LucidHttp
|
8
|
+
def self.base_url
|
9
|
+
@base_url
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.base_url=(new_base_url)
|
13
|
+
@base_url = new_base_url
|
14
|
+
end
|
15
|
+
|
8
16
|
class Client
|
9
|
-
|
17
|
+
def initialize(base_url: ENV.fetch("LUCID_HTTP_BASE_URL"))
|
18
|
+
LucidHttp.base_url = base_url
|
19
|
+
end
|
10
20
|
|
11
|
-
def
|
12
|
-
|
21
|
+
def base_url
|
22
|
+
LucidHttp.base_url
|
13
23
|
end
|
14
24
|
|
15
25
|
%i[get post put patch delete options].each do |verb|
|
@@ -43,30 +53,34 @@ end
|
|
43
53
|
end
|
44
54
|
end
|
45
55
|
|
56
|
+
def response
|
57
|
+
@__response
|
58
|
+
end
|
59
|
+
|
46
60
|
def body
|
47
|
-
|
61
|
+
response.body
|
48
62
|
end
|
49
63
|
|
50
64
|
def verb
|
51
|
-
|
65
|
+
response.verb
|
52
66
|
end
|
53
67
|
|
54
68
|
def status
|
55
|
-
|
69
|
+
response.status
|
56
70
|
end
|
57
71
|
|
58
72
|
def content_type
|
59
|
-
|
73
|
+
response.content_type
|
60
74
|
end
|
61
75
|
|
62
76
|
def url
|
63
|
-
|
77
|
+
response.url
|
64
78
|
end
|
65
79
|
|
66
80
|
def path
|
67
|
-
|
81
|
+
response.path
|
68
82
|
end
|
69
83
|
|
70
84
|
def error
|
71
|
-
|
85
|
+
response.error
|
72
86
|
end
|
data/lucid_http.gemspec
CHANGED
@@ -23,9 +23,11 @@ Gem::Specification.new do |spec|
|
|
23
23
|
|
24
24
|
spec.add_runtime_dependency "http"
|
25
25
|
|
26
|
+
spec.add_development_dependency "bundler", "~> 2.4.8"
|
26
27
|
spec.add_development_dependency "rackup", "~> 2.1.0"
|
27
28
|
spec.add_development_dependency "rake", "~> 13.0.6"
|
28
29
|
spec.add_development_dependency "roda", "~> 3.66.0"
|
29
30
|
spec.add_development_dependency "rspec", "~> 3.12.0"
|
30
|
-
spec.add_development_dependency "
|
31
|
+
spec.add_development_dependency "vcr", "~> 6.1.0"
|
32
|
+
spec.add_development_dependency "webmock", "~> 3.18.1"
|
31
33
|
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.0
|
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
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.4.8
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 2.4.8
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: rackup
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -81,19 +95,33 @@ dependencies:
|
|
81
95
|
- !ruby/object:Gem::Version
|
82
96
|
version: 3.12.0
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
98
|
+
name: vcr
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
101
|
- - "~>"
|
88
102
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
103
|
+
version: 6.1.0
|
90
104
|
type: :development
|
91
105
|
prerelease: false
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
108
|
- - "~>"
|
95
109
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
110
|
+
version: 6.1.0
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: webmock
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 3.18.1
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 3.18.1
|
97
125
|
description: Lucid Http wraps the http.rb gem in a simple DSL. Is particularly useful
|
98
126
|
for screencasts and simple presentations.
|
99
127
|
email:
|