simple_request 0.1.3 → 0.1.4
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 +1 -0
- data/Gemfile.lock +26 -1
- data/README.md +31 -11
- data/bin/rubocop +15 -0
- data/lib/simple_helper/version.rb +1 -1
- data/lib/simple_request.rb +4 -1
- data/simple_request.gemspec +2 -0
- metadata +37 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 100ecf00ae363416d1fc690d1360f56ce380267d0284ed9762671ec5fae0a77b
|
|
4
|
+
data.tar.gz: 479ce1abd4e3bb34e7a677b2276a68a6d7c0ce54c0bc9a166ed5a4e895221e98
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 28f650a6ac946358f87ef9e8a6b8fedecc39200b0ea1818b829479063da76449dd5f683cd8ab8a00ab3a080c1efc580f32646d3fc698685cf0354e149cd0ccbc
|
|
7
|
+
data.tar.gz: 48ecdae3bad9d373af4d41907b12dec9386056447b21c8fd4723f49180d0cf71f53ddc7c95c8ef875c772cef38d7f67617b043a210a0263e625bd6d056a0f09e
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,20 +1,27 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
simple_request (0.1.
|
|
4
|
+
simple_request (0.1.4)
|
|
5
5
|
|
|
6
6
|
GEM
|
|
7
7
|
remote: https://rubygems.org/
|
|
8
8
|
specs:
|
|
9
9
|
addressable (2.7.0)
|
|
10
10
|
public_suffix (>= 2.0.2, < 5.0)
|
|
11
|
+
ast (2.4.1)
|
|
11
12
|
byebug (11.1.3)
|
|
12
13
|
crack (0.4.3)
|
|
13
14
|
safe_yaml (~> 1.0.0)
|
|
14
15
|
diff-lcs (1.4.2)
|
|
15
16
|
hashdiff (1.0.1)
|
|
17
|
+
parallel (1.19.2)
|
|
18
|
+
parser (2.7.2.0)
|
|
19
|
+
ast (~> 2.4.1)
|
|
16
20
|
public_suffix (4.0.5)
|
|
21
|
+
rainbow (3.0.0)
|
|
17
22
|
rake (13.0.1)
|
|
23
|
+
regexp_parser (1.8.2)
|
|
24
|
+
rexml (3.2.4)
|
|
18
25
|
rspec (3.9.0)
|
|
19
26
|
rspec-core (~> 3.9.0)
|
|
20
27
|
rspec-expectations (~> 3.9.0)
|
|
@@ -28,7 +35,23 @@ GEM
|
|
|
28
35
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
29
36
|
rspec-support (~> 3.9.0)
|
|
30
37
|
rspec-support (3.9.3)
|
|
38
|
+
rubocop (0.93.1)
|
|
39
|
+
parallel (~> 1.10)
|
|
40
|
+
parser (>= 2.7.1.5)
|
|
41
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
42
|
+
regexp_parser (>= 1.8)
|
|
43
|
+
rexml
|
|
44
|
+
rubocop-ast (>= 0.6.0)
|
|
45
|
+
ruby-progressbar (~> 1.7)
|
|
46
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
|
47
|
+
rubocop-ast (0.8.0)
|
|
48
|
+
parser (>= 2.7.1.5)
|
|
49
|
+
rubocop-performance (1.8.1)
|
|
50
|
+
rubocop (>= 0.87.0)
|
|
51
|
+
rubocop-ast (>= 0.4.0)
|
|
52
|
+
ruby-progressbar (1.10.1)
|
|
31
53
|
safe_yaml (1.0.5)
|
|
54
|
+
unicode-display_width (1.7.0)
|
|
32
55
|
vcr (5.0.0)
|
|
33
56
|
webmock (3.6.2)
|
|
34
57
|
addressable (>= 2.3.6)
|
|
@@ -43,6 +66,8 @@ DEPENDENCIES
|
|
|
43
66
|
byebug (~> 11.1.3)
|
|
44
67
|
rake (~> 13.0)
|
|
45
68
|
rspec (~> 3.0)
|
|
69
|
+
rubocop (~> 0.93.1)
|
|
70
|
+
rubocop-performance (~> 1.8, >= 1.8.1)
|
|
46
71
|
simple_request!
|
|
47
72
|
vcr (~> 5.0.0)
|
|
48
73
|
webmock (~> 3.6.2)
|
data/README.md
CHANGED
|
@@ -1,23 +1,43 @@
|
|
|
1
1
|
# SimpleRequest
|
|
2
2
|
|
|
3
3
|
`simple_request` founded to make both `HTTP` and `HTTPS` request simple as it should to be
|
|
4
|
+
|
|
5
|
+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
|
6
|
+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
|
7
|
+
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
|
|
8
|
+
|
|
9
|
+
- [Installation](#installation)
|
|
10
|
+
- [Usage](#usage)
|
|
11
|
+
- [GET Request](#get-request)
|
|
12
|
+
- [POST Request](#post-request)
|
|
13
|
+
- [PUT, Patch Request](#put-patch-request)
|
|
14
|
+
- [DELETE Request](#delete-request)
|
|
15
|
+
- [Development](#development)
|
|
16
|
+
- [Contributing](#contributing)
|
|
17
|
+
- [License](#license)
|
|
18
|
+
- [Code of Conduct](#code-of-conduct)
|
|
19
|
+
|
|
20
|
+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
|
21
|
+
|
|
4
22
|
## Installation
|
|
5
23
|
|
|
6
24
|
Add this line to your application's Gemfile:
|
|
7
25
|
|
|
8
26
|
```ruby
|
|
9
|
-
gem 'simple_request'
|
|
27
|
+
gem 'simple_request', '~> 0.1.3'
|
|
10
28
|
```
|
|
11
29
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
Or install it yourself as:
|
|
30
|
+
Then bundle it
|
|
31
|
+
```powershell
|
|
32
|
+
$ bundle
|
|
33
|
+
```
|
|
17
34
|
|
|
18
|
-
|
|
35
|
+
Install it independently:
|
|
36
|
+
```powershell
|
|
37
|
+
$ gem install simple_request
|
|
38
|
+
```
|
|
19
39
|
|
|
20
|
-
##
|
|
40
|
+
## Usage
|
|
21
41
|
|
|
22
42
|
#### GET Request
|
|
23
43
|
```ruby
|
|
@@ -51,7 +71,7 @@ request.path # => "/v1/cities"
|
|
|
51
71
|
request.query # => "limit=1"
|
|
52
72
|
```
|
|
53
73
|
|
|
54
|
-
|
|
74
|
+
#### POST Request
|
|
55
75
|
```ruby
|
|
56
76
|
|
|
57
77
|
request = SimpleRequest.post(
|
|
@@ -73,7 +93,7 @@ request.csv('city,data,attributes')
|
|
|
73
93
|
```
|
|
74
94
|
|
|
75
95
|
|
|
76
|
-
|
|
96
|
+
#### PUT, Patch Request
|
|
77
97
|
```ruby
|
|
78
98
|
|
|
79
99
|
request = SimpleRequest.put(
|
|
@@ -96,7 +116,7 @@ request.plain
|
|
|
96
116
|
# "{\"message\":\"City updated successfully\",\"city\":{\"data\":{\"id\":\"10\",\"type\":\"city_details\",\"attributes\":{\"name_en\":\"Hadramut\",\"name_ar\":\"حضرموت\",\"suggested_time\":0,\"suggested\":false,\"status\":\"active\"}}}}"
|
|
97
117
|
```
|
|
98
118
|
|
|
99
|
-
|
|
119
|
+
#### DELETE Request
|
|
100
120
|
```ruby
|
|
101
121
|
request = SimpleRequest.delete(
|
|
102
122
|
url: 'https://api.xxxxx.xxxxxx.com/v1/cities/10',
|
data/bin/rubocop
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
#
|
|
5
|
+
# This file was generated by Bundler.
|
|
6
|
+
#
|
|
7
|
+
# The application 'rubocop' is installed as part of a gem, and
|
|
8
|
+
# this file is here to facilitate running it.
|
|
9
|
+
|
|
10
|
+
def last_commit_id_of_base_branch
|
|
11
|
+
`git log | sed -n 1p`.split(' ').last
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
puts "== Running rubocop with safe auto correct on modified files after #{last_commit_id_of_base_branch} commit =="
|
|
15
|
+
system("git diff #{last_commit_id_of_base_branch} --name-only | xargs bundle exec rubocop -A")
|
data/lib/simple_request.rb
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require_relative 'simple_helper/hash/keys'
|
|
4
|
-
|
|
5
4
|
%w[config request version exceptions response_parser headers_processor].each do |file_name|
|
|
6
5
|
require_relative "simple_helper/#{file_name}"
|
|
7
6
|
end
|
|
@@ -48,6 +47,10 @@ class SimpleRequest
|
|
|
48
47
|
SimpleHelper::ResponseParser.perform(body_response, 'csv', path)
|
|
49
48
|
end
|
|
50
49
|
|
|
50
|
+
def code
|
|
51
|
+
response&.code
|
|
52
|
+
end
|
|
53
|
+
|
|
51
54
|
private
|
|
52
55
|
|
|
53
56
|
def requested_class
|
data/simple_request.gemspec
CHANGED
|
@@ -31,6 +31,8 @@ Gem::Specification.new do |spec|
|
|
|
31
31
|
spec.add_development_dependency 'byebug', '~> 11.1.3'
|
|
32
32
|
spec.add_development_dependency "rake", "~> 13.0"
|
|
33
33
|
spec.add_development_dependency "rspec", "~> 3.0"
|
|
34
|
+
spec.add_development_dependency 'rubocop', '~> 0.93.1'
|
|
35
|
+
spec.add_development_dependency 'rubocop-performance', '~> 1.8', '>= 1.8.1'
|
|
34
36
|
spec.add_development_dependency 'vcr', '~> 5.0.0'
|
|
35
37
|
spec.add_development_dependency 'webmock', '~> 3.6.2'
|
|
36
38
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: simple_request
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- MaJeD BoJaN
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2021-02-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -66,6 +66,40 @@ dependencies:
|
|
|
66
66
|
- - "~>"
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
68
|
version: '3.0'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: rubocop
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - "~>"
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: 0.93.1
|
|
76
|
+
type: :development
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - "~>"
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: 0.93.1
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: rubocop-performance
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - "~>"
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: '1.8'
|
|
90
|
+
- - ">="
|
|
91
|
+
- !ruby/object:Gem::Version
|
|
92
|
+
version: 1.8.1
|
|
93
|
+
type: :development
|
|
94
|
+
prerelease: false
|
|
95
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
96
|
+
requirements:
|
|
97
|
+
- - "~>"
|
|
98
|
+
- !ruby/object:Gem::Version
|
|
99
|
+
version: '1.8'
|
|
100
|
+
- - ">="
|
|
101
|
+
- !ruby/object:Gem::Version
|
|
102
|
+
version: 1.8.1
|
|
69
103
|
- !ruby/object:Gem::Dependency
|
|
70
104
|
name: vcr
|
|
71
105
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -114,6 +148,7 @@ files:
|
|
|
114
148
|
- README.md
|
|
115
149
|
- Rakefile
|
|
116
150
|
- bin/console
|
|
151
|
+
- bin/rubocop
|
|
117
152
|
- bin/setup
|
|
118
153
|
- lib/simple_helper/array/to_csv.rb
|
|
119
154
|
- lib/simple_helper/array/wrap.rb
|