restup 1.0.1 → 1.1.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 821def49d7ed7b1bfe9fece4bdccf8711439f3dd
4
- data.tar.gz: 22a09bc07b0613224205ef9b03a499f3f05fe0e4
3
+ metadata.gz: 7aaee4cc3597cafbc7d621aa6e03fcbf88e2d3b5
4
+ data.tar.gz: 0a47d288b19a3b9d49052c86bb38ee65c2045bfc
5
5
  SHA512:
6
- metadata.gz: 053726b4acc83c478528d144d47da2b8423f2da294f1c52ed35b9ab7dd3a20f97d580962c6e9a37fb555e5a82a36b577cfd591f5600232606f8bae36f20a5721
7
- data.tar.gz: 66ef657596c00a2255485f48847c575262702167df22b4ef7014e1c2c1d6db4b57a84b366b294403d8d4b642db2ace5f2018ea47d5a1ed32747518845e44e146
6
+ metadata.gz: 7c8816e02ba2fc5e192a48bbde383073871b4186961bba063aa68d5a3c7164a9edbd5d10218aafab0e5be4df46b131f0502f45ca19eb893f9b876d700363d27e
7
+ data.tar.gz: 0e963d7b0d1ad86c84e96298f30f02d0580abdf766984a7400ef3b6cb0021a7a2548383641a9871452f2325553ffb70bc99628437cdcb1920ddac0d4bea31f9f
@@ -0,0 +1,50 @@
1
+ ### Version Changelog
2
+ 1.1.3 Updated to use [Paint v. 2.0](https://github.com/janlelis/paint) gem.
3
+
4
+ 1.0.1 Fixes issue [#33](https://github.com/thoom/restclient/issues/33).
5
+
6
+ 1.0.0 RestClient => RestUp. _Finally_ out of beta.
7
+ - Fixes Github issue [#30](https://github.com/thoom/restclient/issues/30) by renaming RestClient to RestUp.
8
+ - Fixes Github issue [#28](https://github.com/thoom/restclient/issues/28). `--form` converts JSON to form data only.
9
+ To use form data, manually set the header using the `-h` option or set the header in the configuration.
10
+ - Fixes Github issues [#24](https://github.com/thoom/restclient/issues/24) and [#25](https://github.com/thoom/restclient/issues/25). Use `--verbose` or set `flags: { display: verbose }` in config.
11
+ - Fixes Github issue [#31](https://github.com/thoom/restclient/issues/31). Use `-c` or `--config` to pass in another config file.
12
+ - Fixes Github issue [#20](https://github.com/thoom/restclient/issues/20).
13
+ - Fixes Github issue [#11](https://github.com/thoom/restclient/issues/11).
14
+
15
+
16
+ 0.14.3 Fixes Github issues [#21](https://github.com/thoom/restclient/issues/21) and [#26](https://github.com/thoom/restclient/issues/26).
17
+ You can use YAML now instead of JSON for JSON requests. Since JSON is a subset of YAML, this is not a breaking change.
18
+
19
+ 0.14.2 Fixes Github issue [#17](https://github.com/thoom/restclient/issues/17). It also simplifies how files or data are passed into the client.
20
+ Breaking change because flags -f and -d have been removed. Instead just pass in with STDIN instead.
21
+
22
+ 0.13.0 Fixes Github issue [#13](https://github.com/thoom/restclient/issues/13).
23
+ Breaking change since it no longer creates a config file if one doesn't exist.
24
+
25
+ 0.12.1: Fixes Github issues [#12](https://github.com/thoom/restclient/issues/12) and [#19](https://github.com/thoom/restclient/issues/19).
26
+ If using the library class instead of the CLI, you can pass in a `Thoom::HashConfig` object,
27
+ instead of requiring a YAML file. CLI no longer generates a deprecated warning in the Ruby 2.3.
28
+
29
+ 0.11.3: Adds a simple response time to the output.
30
+
31
+ 0.11.2: Fixes Github issue [#10](https://github.com/thoom/restclient/issues/10).
32
+
33
+ 0.11.1: Fixes Github issues [#2](https://github.com/thoom/restclient/issues/2), [#5](https://github.com/thoom/restclient/issues/5), [#6](https://github.com/thoom/restclient/issues/6), [#7](https://github.com/thoom/restclient/issues/7), and [#8](https://github.com/thoom/restclient/issues/8). If a configuration file is not found,
34
+ there is now a simple wizard that will ask a few questions and then generate the config file.
35
+
36
+ 0.10.1: Fixes Github issues [#1](https://github.com/thoom/restclient/issues/1) and [#4](https://github.com/thoom/restclient/issues/4). `PUT`, `PATCH`, and `POST` all set a default `JSON` content type. Added `--response-only` flag.
37
+
38
+ 0.10.0: Fixed a bug missed where headers in the YAML file were not parsed. Changed the YAML :headers: to use a hash instead of array.
39
+
40
+ 0.9.3: Rewrote console output mechanism. Fixed a few bugs related to YAML configuration. Added `--response-code-only` and `--success-only` flags.
41
+
42
+ 0.9.0: Significant internal refactoring to the client. Also changed console coloring dependency to the `Paint` gem instead of `Colored` gem.
43
+
44
+ 0.8.5: Added option to save response to the filename in the content-disposition if that header is passed.
45
+
46
+ 0.8.4: Added option to save response to a file by passing in the -o {file} arg. For binary files, response is never output in summary.
47
+
48
+ 0.7.5: Added option to change the request timeout. Added option to disable TLS cert validation (Useful with self-signed certs).
49
+
50
+ 0.7.0: Removed dependency on Nokogiri for XML parsing.
data/README.md CHANGED
@@ -31,25 +31,26 @@ To install:
31
31
 
32
32
  To run:
33
33
 
34
- docker run --rm -v $PWD:/usr/src/restup thoom/restup
34
+ docker run --rm -v $PWD:/restup thoom/restup
35
35
 
36
36
  A sample shell script `restup`:
37
37
 
38
38
  #!/bin/bash
39
- docker run --rm -v $PWD:/usr/src/restup thoom/restup "@"
39
+ docker run --rm -v $PWD:/restup thoom/restup "@"
40
40
 
41
41
  Console
42
42
  -------
43
43
 
44
44
  Usage: restclient [options] ENDPOINT
45
- --concise Disables verbose output
45
+ --concise Simplified response view
46
46
  --content-disposition For responses with a filename in the Content Disposition, save the response using that filename
47
47
  --form Converts JSON-formatted input and encode it as x-www-form-urlencoded
48
48
  --response-only Only outputs the response body
49
49
  --response-code-only Only outputs the response code
50
50
  --success-only Only outputs whether or not the request was successful
51
51
  --cert CERTFILE Imports cert for Client-Authentication endpoints
52
- -c, --config FILE Config file to use. Defaults to .restup.yml -e, --env ENVIRONMENT Sets YAML environment for the request
52
+ -c, --config FILE Config file to use. Defaults to .restup.yml
53
+ -e, --env ENVIRONMENT Sets YAML environment for the request
53
54
  -h, --header HEADER Sets arbitrary header passed in format "HEADER: VALUE"
54
55
  -j, --json [c|a] Sets the Content-Type and/or Accept Headers to use JSON mime types (i.e. -ja)
55
56
  -m, --method The HTTP method to use (defaults to GET)
@@ -57,9 +58,9 @@ Console
57
58
  -p, --password PASSWORD Password for Basic Authentication
58
59
  -u, --username USERNAME Username for Basic Authentication
59
60
  -x, --xml [c|a] Sets the Content-Type and/or Accept Headers to use XML mime types (i.e. -xc)
60
- --verbose Provides a nice UI for your API responses
61
+ --verbose Expanded response view
61
62
  --version Shows client version
62
- --help [details] Shows this message
63
+ --help [details] Shows this help dialog
63
64
 
64
65
  YAML config
65
66
  -----------
@@ -93,11 +94,8 @@ folders.
93
94
  Default: response_only
94
95
 
95
96
  headers: Hash of default headers. Useful for custom headers or headers used in every request.
96
- The keys for this hash are strings, not symbols like the other keys
97
-
98
97
  timeout: The number of seconds to wait for a response before timing out. Default: 300
99
-
100
- tls_verify: When using TLS, the verify mode to use. Values: true, false. Default: true
98
+ tls_verify: Whether or not to verify TLS (SSL) certificates. Values: true, false. Default: true
101
99
 
102
100
  xmethods: Array of nonstandard methods that are accepted by the API. To use these methods the
103
101
  API must support X-HTTP-Method-Override.
@@ -124,8 +122,8 @@ To use without the config:
124
122
  Submits a GET request to `http://example/api/hello/world` with Basic Auth header using the
125
123
  user and pass values in the config.
126
124
 
127
- It would return JSON values. If successful, the JSON would be parsed and highlighted in __:colors::success:__. If
128
- the an error was returned (an HTTP response code >= 400), the body would be in __:colors::error:__.
125
+ It would return JSON values. If successful, the JSON would be parsed and highlighted in __colors['success']__. If
126
+ the an error was returned (an HTTP response code >= 400), the body would be in __colors['error']__.
129
127
 
130
128
  ### POST Request
131
129
 
@@ -149,8 +147,8 @@ Submits a POST request to `http://example/api/hello/world` with Basic Auth heade
149
147
  user and pass values in the config. It imports the salutation.json and passes it to the API as application/json
150
148
  content type. It would also set the `X-Custom-Id` header with every request.
151
149
 
152
- It would return JSON values. If successful, the JSON would be parsed and highlighted in __:colors::success:__. If
153
- the an error was returned (an HTTP response code >= 400), the body would be in __:colors::error:__.
150
+ It would return JSON values. If successful, the JSON would be parsed and highlighted in __colors['success']__. If
151
+ the an error was returned (an HTTP response code >= 400), the body would be in __colors['error']__.
154
152
 
155
153
 
156
154
  Migration From RestClient
data/bin/restup CHANGED
@@ -36,7 +36,7 @@ opts_builder = nil
36
36
 
37
37
  parser = OptionParser.new do |o|
38
38
  o.banner = 'Usage: restup [options] ENDPOINT'
39
- o.on('--concise', 'Disables verbose output') do
39
+ o.on('--concise', 'Simplified response view') do
40
40
  opts[:display] = :concise
41
41
  end
42
42
 
@@ -59,7 +59,7 @@ parser = OptionParser.new do |o|
59
59
  opts[:display] = :success_only
60
60
  end
61
61
 
62
- o.on('--cert CERTFILE', 'Imports cert for Client-Authentication endpoints') do |cert|
62
+ o.on('--cert FILE', 'Imports cert for Client-Authentication endpoints') do |cert|
63
63
  opts[:cert] = cert
64
64
  end
65
65
 
@@ -88,7 +88,7 @@ parser = OptionParser.new do |o|
88
88
  end
89
89
  end
90
90
 
91
- o.on('-m', '--method METHOD', 'Save output to file passed') do |method_name|
91
+ o.on('-m', '--method METHOD', 'The HTTP method to use') do |method_name|
92
92
  opts[:method] = method_name
93
93
  end
94
94
 
@@ -116,7 +116,7 @@ parser = OptionParser.new do |o|
116
116
  end
117
117
  end
118
118
 
119
- o.on('--verbose', 'Provides a nice UI for your API responses') do
119
+ o.on('--verbose', 'Expanded response view') do
120
120
  opts[:display] = :verbose
121
121
  end
122
122
 
@@ -1,6 +1,8 @@
1
1
  module Thoom
2
2
  class Constants
3
- VERSION = '1.0'.freeze
3
+ BUILD_DATE = '2017-03-20'.freeze
4
+ VERSION = '1.1.3'.freeze
5
+
4
6
  MIME_JSON = 'application/json'.freeze
5
7
  MIME_XML = 'application/xml'.freeze
6
8
  end
@@ -90,11 +90,8 @@ flags: Default command line options
90
90
  Default: response_only
91
91
 
92
92
  headers: Hash of default headers. Useful for custom headers or headers used in every request.
93
- The keys for this hash are strings, not symbols like the other keys
94
-
95
93
  timeout: The number of seconds to wait for a response before timing out. Default: 300
96
-
97
- tls_verify: When using TLS, the verify mode to use. Values: true, false. Default: true
94
+ tls_verify: Whether or not to verify TLS (SSL) certificates. Values: true, false. Default: true
98
95
 
99
96
  xmethods: Array of nonstandard methods that are accepted by the API. To use these methods the
100
97
  API must support X-HTTP-Method-Override.
@@ -216,21 +213,21 @@ TEXT
216
213
  else
217
214
  body = response.body
218
215
  begin
219
- body.encode!('ASCII-8BIT') if body.encoding.to_s != 'ASCII-8BIT'
220
-
221
- body = if response['content-type'].nil?
222
- body
223
- elsif response['content-type'].include? 'json'
224
- JSON.pretty_unparse(JSON.parse(body))
225
- elsif response['content-type'].include? 'xml'
226
- xp(body)
227
- else
228
- body
229
- end
230
- puts Paint[body, response_color]
231
- rescue EncodingError => e
232
- puts Paint["RESPONSE contains non-UTF-8 data, so it's not echoed here.", colors[:info]]
233
- end
216
+ body.encode!('ASCII-8BIT') if body.encoding.to_s != 'ASCII-8BIT'
217
+
218
+ body = if response['content-type'].nil?
219
+ body
220
+ elsif response['content-type'].include? 'json'
221
+ JSON.pretty_unparse(JSON.parse(body))
222
+ elsif response['content-type'].include? 'xml'
223
+ xp(body)
224
+ else
225
+ body
226
+ end
227
+ puts Paint[body, response_color]
228
+ rescue EncodingError
229
+ puts Paint["RESPONSE contains non-UTF-8 data, so it's not echoed here.", colors[:info]]
230
+ end
234
231
  end
235
232
  end
236
233
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: restup
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Z.d. Peacock
@@ -16,21 +16,25 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.0'
19
+ version: '2.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.0'
26
+ version: '2.0'
27
27
  description: A class and executable for interacting with RESTful web services
28
28
  email: zdp@thoomtech.com
29
29
  executables:
30
30
  - restup
31
31
  extensions: []
32
- extra_rdoc_files: []
32
+ extra_rdoc_files:
33
+ - README.md
34
+ - CHANGELOG.md
35
+ - LICENSE
33
36
  files:
37
+ - CHANGELOG.md
34
38
  - LICENSE
35
39
  - README.md
36
40
  - bin/restup
@@ -50,7 +54,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
50
54
  requirements:
51
55
  - - ">="
52
56
  - !ruby/object:Gem::Version
53
- version: '0'
57
+ version: '2.1'
54
58
  required_rubygems_version: !ruby/object:Gem::Requirement
55
59
  requirements:
56
60
  - - ">="