faraday-cli 0.7.1 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/bin/faraday-cli +1 -2
- data/lib/faraday/cli/option/validator.rb +10 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6273aa84eb1af9c0810d1285ef24178d4633b750
|
4
|
+
data.tar.gz: 1dbf902b9ec7ef2711380e61e7d48adb8b1615e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15c59474c856b920a4c3e7fc781221880eb58a5b02026c0b6323f19c2911a8560083754925cf256915142e556f5195789dae054fb334e17f4e88d8618d203fb4
|
7
|
+
data.tar.gz: e8700b038a3eab6c6f57c74c511d49511b1dcb0ff404bcdd2263efa163acebf49d1a9f29fd28c1b72c550a6f6b46951ea35980a07c755a2450c751b3bcaab1cb
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.7.
|
1
|
+
0.7.2
|
data/bin/faraday-cli
CHANGED
@@ -6,7 +6,7 @@ end
|
|
6
6
|
require 'faraday/cli'
|
7
7
|
|
8
8
|
CLI_OPTIONS = Faraday::CLI::Option::Parser.new.parse!
|
9
|
-
Faraday::CLI::Option::Validator.validate(CLI_OPTIONS)
|
9
|
+
Faraday::CLI::Option::Validator.validate(ARGV,CLI_OPTIONS)
|
10
10
|
|
11
11
|
connection = Faraday.new do |builder|
|
12
12
|
builder.use Faraday::Response::RaiseError
|
@@ -44,7 +44,6 @@ begin
|
|
44
44
|
|
45
45
|
response = connection.public_send(CLI_OPTIONS[:http_method].downcase) do |request|
|
46
46
|
|
47
|
-
raise('Missing URL for request!') if ARGV[0].nil?
|
48
47
|
request.url(ARGV[0])
|
49
48
|
|
50
49
|
CLI_OPTIONS[:http_headers].each do |key, value|
|
@@ -3,12 +3,21 @@ module Faraday::CLI::Option::Validator
|
|
3
3
|
|
4
4
|
ALLOWED_HTTP_METHODS = %w(get head post put patch delete options)
|
5
5
|
|
6
|
-
def validate(options_hash)
|
6
|
+
def validate(argv,options_hash)
|
7
|
+
validate_url(argv[0])
|
7
8
|
validate_http_method(options_hash)
|
8
9
|
end
|
9
10
|
|
11
|
+
|
10
12
|
protected
|
11
13
|
|
14
|
+
def validate_url(url_str)
|
15
|
+
if url_str.nil? || url_str == ''
|
16
|
+
$stderr.puts('Missing URL to make request!')
|
17
|
+
exit(1)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
12
21
|
def validate_http_method(options_hash)
|
13
22
|
unless ALLOWED_HTTP_METHODS.include?(options_hash[:http_method])
|
14
23
|
$stderr.puts("invalid http method given: #{options_hash[:http_method].inspect}")
|