wor-requests 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +31 -0
- data/lib/wor/requests/base.rb +2 -2
- data/lib/wor/requests/version.rb +1 -1
- data/wor-requests.gemspec +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab5a51f2877974f836e6c6275f03a461c3b4f707
|
4
|
+
data.tar.gz: b06bac7b122ee50d17a3232f99b250000850320f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c1ea9a833e798677bc1314f5131408fe24a599fdfb353d34c53bf77366ddada243e74ec54e76fb55129fbebc404064b185ad542b81c663d216321c19b2a4c16
|
7
|
+
data.tar.gz: 9e0f623dec18850fdb63fafaa732930f0dae07b3ccdec2d9fe81d6097b21468f41867e6b4778bb613ee43b213f073f06457b1b118dee17a0ec7369c3cd1f9944
|
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
@@ -62,6 +62,37 @@ puts GithubService.new.repositories('alebian')
|
|
62
62
|
|
63
63
|
Or, even easier, run `rails generate wor:requests:service NAME` in your Rails root
|
64
64
|
|
65
|
+
|
66
|
+
If you need to send body parameters in a post request you can write something like this:
|
67
|
+
|
68
|
+
```ruby
|
69
|
+
require 'wor/requests'
|
70
|
+
|
71
|
+
class ExternalService < Wor::Requests::Base
|
72
|
+
def post_request_example(authorization)
|
73
|
+
post(
|
74
|
+
attempting_to: 'Make a POST request to an external service.',
|
75
|
+
path: '/some_endpoint',
|
76
|
+
headers: {
|
77
|
+
Authorization: authorization,
|
78
|
+
'Content-type' => 'application/json'
|
79
|
+
},
|
80
|
+
body: {
|
81
|
+
# Some Json
|
82
|
+
}
|
83
|
+
)
|
84
|
+
end
|
85
|
+
|
86
|
+
protected
|
87
|
+
|
88
|
+
def base_url
|
89
|
+
'https://external.service.com'
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
ExternalService.new.post_request_example(token)
|
94
|
+
```
|
95
|
+
|
65
96
|
## Contributing
|
66
97
|
|
67
98
|
1. Fork it
|
data/lib/wor/requests/base.rb
CHANGED
@@ -85,12 +85,12 @@ module Wor
|
|
85
85
|
end
|
86
86
|
|
87
87
|
def formatted_base_url
|
88
|
-
base_url
|
88
|
+
base_url[-1] != '/' ? "#{base_url}/" : base_url
|
89
89
|
end
|
90
90
|
|
91
91
|
def formatted_path(path)
|
92
92
|
return '' if path.nil?
|
93
|
-
return path if path
|
93
|
+
return path if path[0] != '/'
|
94
94
|
path.slice!(0)
|
95
95
|
path
|
96
96
|
end
|
data/lib/wor/requests/version.rb
CHANGED
data/wor-requests.gemspec
CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.require_paths = ['lib']
|
23
23
|
|
24
24
|
spec.add_dependency 'httparty', '~> 0.13'
|
25
|
-
spec.add_dependency 'railties', '>= 4.1.0', '< 5.
|
25
|
+
spec.add_dependency 'railties', '>= 4.1.0', '< 5.2'
|
26
26
|
|
27
27
|
spec.add_development_dependency 'faker'
|
28
28
|
spec.add_development_dependency 'webmock'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wor-requests
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- draffo
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-11-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|
@@ -34,7 +34,7 @@ dependencies:
|
|
34
34
|
version: 4.1.0
|
35
35
|
- - "<"
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version: '5.
|
37
|
+
version: '5.2'
|
38
38
|
type: :runtime
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -44,7 +44,7 @@ dependencies:
|
|
44
44
|
version: 4.1.0
|
45
45
|
- - "<"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '5.
|
47
|
+
version: '5.2'
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: faker
|
50
50
|
requirement: !ruby/object:Gem::Requirement
|
@@ -198,6 +198,7 @@ files:
|
|
198
198
|
- ".rspec"
|
199
199
|
- ".rubocop.yml"
|
200
200
|
- ".travis.yml"
|
201
|
+
- CHANGELOG.md
|
201
202
|
- Gemfile
|
202
203
|
- LICENSE.md
|
203
204
|
- README.md
|
@@ -232,7 +233,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
232
233
|
version: '0'
|
233
234
|
requirements: []
|
234
235
|
rubyforge_project:
|
235
|
-
rubygems_version: 2.6.
|
236
|
+
rubygems_version: 2.6.11
|
236
237
|
signing_key:
|
237
238
|
specification_version: 4
|
238
239
|
summary: Make external requests in you service objects, with easy logging and error
|