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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: daf7bed634eb91d053706c958f8447416cdb399b
4
- data.tar.gz: 09f346257fbbfdaf6c05702d3a4a44be9722f80e
3
+ metadata.gz: 6273aa84eb1af9c0810d1285ef24178d4633b750
4
+ data.tar.gz: 1dbf902b9ec7ef2711380e61e7d48adb8b1615e9
5
5
  SHA512:
6
- metadata.gz: 28430eca7f01bc760f87f3b52bd96bac610598cd4f80645bbf90303f7aa703a9e9a42215ac227f746f36911a7d1247f3660c6a47f932a9157acd8986d02e9cc1
7
- data.tar.gz: 54e9e40b4744ea0afa404d2c867843cd227d544c6f576ed7c42487d014b7bc337735dc07f2394aa60d170cf4fd3bc8501c84727a550e71ce25f90a8a2ed0b222
6
+ metadata.gz: 15c59474c856b920a4c3e7fc781221880eb58a5b02026c0b6323f19c2911a8560083754925cf256915142e556f5195789dae054fb334e17f4e88d8618d203fb4
7
+ data.tar.gz: e8700b038a3eab6c6f57c74c511d49511b1dcb0ff404bcdd2263efa163acebf49d1a9f29fd28c1b72c550a6f6b46951ea35980a07c755a2450c751b3bcaab1cb
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.1
1
+ 0.7.2
@@ -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}")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faraday-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Luzsi