doterb_http 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +11 -0
- data/Gemfile.lock +59 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/doterb_http.gemspec +7 -7
- data/lib/doterb_http/get.rb +32 -0
- data/lib/doterb_http/post.rb +32 -0
- data/lib/doterb_http/version.rb +1 -1
- metadata +9 -4
- data/sig/doterb_http.rbs +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ae76798e3f0263a88bd8c140c1ad760f6882ee4987e5497e37b86a455973526
|
4
|
+
data.tar.gz: a34bdeb34f0e430da1a95d2db38fb9b6a92b6af313b21f8e3750a9dc9fa65dfc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c91ab88f3a4f271762c8c2cbf21f033d42c977c542f2204532945482bcbe16ad45bd8a626eb60904e22e9c73b0d67c538f880853b8227332ef5cf325f324f84
|
7
|
+
data.tar.gz: c24989999503c04fb49fa3484d62408065e4c80e529377216d86293da42173f3685bb06cbec2d0431f7ec1e2b590d3b5083b1d40713e98f124b808554f484eba
|
data/.gitignore
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
doterb_http (0.1.5)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
ast (2.4.2)
|
10
|
+
diff-lcs (1.5.0)
|
11
|
+
dry-initializer (3.0.4)
|
12
|
+
json (2.6.3)
|
13
|
+
parallel (1.23.0)
|
14
|
+
parser (3.2.2.1)
|
15
|
+
ast (~> 2.4.1)
|
16
|
+
rainbow (3.1.1)
|
17
|
+
rake (13.0.6)
|
18
|
+
regexp_parser (2.8.0)
|
19
|
+
rexml (3.2.5)
|
20
|
+
rspec (3.12.0)
|
21
|
+
rspec-core (~> 3.12.0)
|
22
|
+
rspec-expectations (~> 3.12.0)
|
23
|
+
rspec-mocks (~> 3.12.0)
|
24
|
+
rspec-core (3.12.2)
|
25
|
+
rspec-support (~> 3.12.0)
|
26
|
+
rspec-expectations (3.12.3)
|
27
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
28
|
+
rspec-support (~> 3.12.0)
|
29
|
+
rspec-mocks (3.12.5)
|
30
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
31
|
+
rspec-support (~> 3.12.0)
|
32
|
+
rspec-support (3.12.0)
|
33
|
+
rubocop (1.51.0)
|
34
|
+
json (~> 2.3)
|
35
|
+
parallel (~> 1.10)
|
36
|
+
parser (>= 3.2.0.0)
|
37
|
+
rainbow (>= 2.2.2, < 4.0)
|
38
|
+
regexp_parser (>= 1.8, < 3.0)
|
39
|
+
rexml (>= 3.2.5, < 4.0)
|
40
|
+
rubocop-ast (>= 1.28.0, < 2.0)
|
41
|
+
ruby-progressbar (~> 1.7)
|
42
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
43
|
+
rubocop-ast (1.28.1)
|
44
|
+
parser (>= 3.2.1.0)
|
45
|
+
ruby-progressbar (1.13.0)
|
46
|
+
unicode-display_width (2.4.2)
|
47
|
+
|
48
|
+
PLATFORMS
|
49
|
+
x86_64-darwin-19
|
50
|
+
|
51
|
+
DEPENDENCIES
|
52
|
+
doterb_http!
|
53
|
+
dry-initializer (~> 3.0.4)
|
54
|
+
rake (~> 13.0)
|
55
|
+
rspec (~> 3.0)
|
56
|
+
rubocop (~> 1.21)
|
57
|
+
|
58
|
+
BUNDLED WITH
|
59
|
+
2.4.4
|
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "bundler/setup"
|
5
|
+
require "doterb_http"
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require "irb"
|
15
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/doterb_http.gemspec
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
lib = File.expand_path('../lib', __FILE__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
5
|
require_relative "lib/doterb_http/version"
|
4
6
|
|
5
7
|
Gem::Specification.new do |spec|
|
@@ -11,7 +13,6 @@ Gem::Specification.new do |spec|
|
|
11
13
|
spec.summary = ""
|
12
14
|
spec.description = ""
|
13
15
|
spec.homepage = "https://github.com/thufailathhar0/doterb_http"
|
14
|
-
spec.required_ruby_version = ">= 2.6.0"
|
15
16
|
|
16
17
|
spec.metadata["allowed_push_host"] = "https://rubygems.org/"
|
17
18
|
|
@@ -21,13 +22,12 @@ Gem::Specification.new do |spec|
|
|
21
22
|
|
22
23
|
# Specify which files should be added to the gem when it is released.
|
23
24
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
24
|
-
spec.files =
|
25
|
-
|
26
|
-
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|circleci)|appveyor)})
|
27
|
-
end
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
26
|
+
f.match(%r{^(test|spec|features)/})
|
28
27
|
end
|
29
|
-
|
30
|
-
spec.
|
28
|
+
|
29
|
+
# spec.bindir = "exe"
|
30
|
+
# spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
31
31
|
spec.require_paths = ["lib"]
|
32
32
|
|
33
33
|
# Uncomment to register a new dependency of your gem
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "net/http"
|
4
|
+
require "dry-initializer"
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
module DoterbHttp
|
8
|
+
class Get
|
9
|
+
extend Dry::Initializer
|
10
|
+
|
11
|
+
option :url
|
12
|
+
option :body, optional: true
|
13
|
+
|
14
|
+
def call
|
15
|
+
uri = URI.parse(url)
|
16
|
+
uri.query = URI.encode_www_form(body) if body
|
17
|
+
|
18
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
19
|
+
http.use_ssl = true
|
20
|
+
request = Net::HTTP::Get.new(uri.request_uri)
|
21
|
+
request['Content-Type'] = "application/json"
|
22
|
+
request['Accept'] = "application/json"
|
23
|
+
|
24
|
+
response = http.request(request)
|
25
|
+
if response.code == '200'
|
26
|
+
JSON.parse(response.body)
|
27
|
+
else
|
28
|
+
raise response.body
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "net/http"
|
4
|
+
require "dry-initializer"
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
module DoterbHttp
|
8
|
+
class Post
|
9
|
+
extend Dry::Initializer
|
10
|
+
|
11
|
+
option :url
|
12
|
+
option :body, optional: true
|
13
|
+
|
14
|
+
def call
|
15
|
+
uri = URI.parse(url)
|
16
|
+
|
17
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
18
|
+
http.use_ssl = true
|
19
|
+
request = Net::HTTP::Post.new(uri.request_uri)
|
20
|
+
request['Content-Type'] = "application/json"
|
21
|
+
request['Accept'] = "application/json"
|
22
|
+
request.body = body.to_json if body
|
23
|
+
|
24
|
+
response = http.request(request)
|
25
|
+
if response.code == '200'
|
26
|
+
JSON.parse(response.body)
|
27
|
+
else
|
28
|
+
raise response.body
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/doterb_http/version.rb
CHANGED
metadata
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: doterb_http
|
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
|
- thufail athhar
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2023-05-26 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
@@ -17,17 +17,22 @@ executables: []
|
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
+
- ".gitignore"
|
20
21
|
- ".rspec"
|
21
22
|
- ".rubocop.yml"
|
22
23
|
- CHANGELOG.md
|
23
24
|
- CODE_OF_CONDUCT.md
|
24
25
|
- Gemfile
|
26
|
+
- Gemfile.lock
|
25
27
|
- README.md
|
26
28
|
- Rakefile
|
29
|
+
- bin/console
|
30
|
+
- bin/setup
|
27
31
|
- doterb_http.gemspec
|
28
32
|
- lib/doterb_http.rb
|
33
|
+
- lib/doterb_http/get.rb
|
34
|
+
- lib/doterb_http/post.rb
|
29
35
|
- lib/doterb_http/version.rb
|
30
|
-
- sig/doterb_http.rbs
|
31
36
|
homepage: https://github.com/thufailathhar0/doterb_http
|
32
37
|
licenses: []
|
33
38
|
metadata:
|
@@ -43,7 +48,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
43
48
|
requirements:
|
44
49
|
- - ">="
|
45
50
|
- !ruby/object:Gem::Version
|
46
|
-
version:
|
51
|
+
version: '0'
|
47
52
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
48
53
|
requirements:
|
49
54
|
- - ">="
|
data/sig/doterb_http.rbs
DELETED