mudbug 0.8.1.3 → 0.8.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- ZjQ2NGZmMWJlODIxMWM5M2Q5N2E5NTlkZjc0OGYxMTMyNTM5NzVjOQ==
5
- data.tar.gz: !binary |-
6
- Y2NiZTczNGIzYWRhNTRhMTM5NTA4ODVkOGUwYjY3MWYzY2E2NTNmOQ==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- ZWQwZDc4ZDI3NmY3Mzg4ZjYzOTcyY2RmODc3MzZjMDFjYWExOTM3Y2NjM2Vi
10
- YjIwYzA4NWEzY2NmOGFmYzIyNzMxNWQ0YzE5YmFjZGY5ZDRiZDgxOGIzNzg3
11
- YjRlZWM5MDgyOTc3NDJjZDRkZWExZTdjNmY5ZGI3MDVjNDhhYTU=
12
- data.tar.gz: !binary |-
13
- MzBkNDNhNWQ3NmVkMzU2MmI2MmVhYTNmYmNhMTA4YjFmMTliZWRjMWRlODM0
14
- YjhmYWI5ZGU5YjNmOWUxM2M3NTkwYmZmY2JjMmE2OTIxNzBjZWI5OTYxODNi
15
- NDVkZmRlNWY3MWZlNGI0M2ZhYWE4NWFiNWRlOWRjZjUwOGM3MmY=
2
+ SHA1:
3
+ metadata.gz: 91fd87c8358e5fa24b35be00f7e0a56163ae5c61
4
+ data.tar.gz: b0d36c531cce737f2cf46ef963fe74a39ed1413e
5
+ SHA512:
6
+ metadata.gz: fbbb7165597419c3615f7844dcdbb75b34d7d6708d47e90598e980d78ace7d543556381f37cc005aff23e9eee4ea36ef3bfb0f7a812d889f9a7c51de2fb85832
7
+ data.tar.gz: 3fbcf0f38591c02be97a2f2b979a753c5df53498dd6d40d13849f83ceaff4e19ab7cc79590de012abc63eb12761ab2da8610444ebca70c3da4bf70adf3bc0fe6
data/README.md CHANGED
@@ -1,7 +1,14 @@
1
+ [![Gem Version](https://badge.fury.io/rb/mudbug.svg)](http://badge.fury.io/rb/mudbug)
2
+ [![Code Climate](https://codeclimate.com/github/rickhull/mudbug/badges/gpa.svg)](https://codeclimate.com/github/rickhull/mudbug)
3
+ [![Dependency Status](https://gemnasium.com/rickhull/mudbug.svg)](https://gemnasium.com/rickhull/mudbug)
4
+ [![Security Status](https://hakiri.io/github/rickhull/mudbug/master.svg)](https://hakiri.io/github/rickhull/mudbug/master)
5
+
1
6
  Mudbug
2
7
  =======
3
8
  Mudbug is a JSON-oriented, thin wrapper around [rest-client](https://github.com/rest-client/rest-client)'s [RestClient::Resource](https://github.com/rest-client/rest-client#usage-activeresource-style)
4
9
 
10
+ An executable `mb` is provided, which compares favorably to `curl` or `wget` in applicable situations.
11
+
5
12
  Features
6
13
  --------
7
14
  * *GET*, *POST*, *PUT*, or *DELETE* JSON payloads
@@ -19,8 +26,9 @@ $ gem install mudbug # sudo as necessary
19
26
  ```
20
27
  Or, if using [Bundler](http://bundler.io/), add to your Gemfile:
21
28
  ```ruby
22
- gem 'mudbug', '~> 0.6'
29
+ gem 'mudbug', '~> 0.8'
23
30
  ```
31
+
24
32
  Quick Start
25
33
  -----------
26
34
  Initialize it with a host:
@@ -55,18 +63,18 @@ Declare what you accept: (optional, default shown)
55
63
  mb.accept :json, :html, :text
56
64
  ```
57
65
 
58
- You can pass through per-request [options to rest-client](https://github.com/rest-client/rest-client/blob/master/lib/restclient/request.rb)
66
+ You can pass through per-request query params:
59
67
 
60
68
  ```ruby
61
- mb.get '/', max_redirects: 3
62
- # => "<!doctype html><html ... <head><meta content=\"Search the world's information ... "
69
+ mb.get '/', foo: bar
70
+ # i.e. GET /?foo=bar
63
71
  ```
64
72
 
65
73
  [RestClient exceptions](https://github.com/rest-client/rest-client/blob/master/lib/restclient/exceptions.rb) will be passed through. POST and PUT payloads will be sent as strings. Non-string payloads will be converted to JSON by calling #to_json.
66
74
 
67
75
  ```ruby
68
76
  mb = Mudbug.new 'plus.google.com'
69
- mb.post '/', { 'hi' => 'mom' }, max_redirects: 3
77
+ mb.post '/', { 'hi' => 'mom' }
70
78
 
71
79
  # /path/to/lib/restclient/abstract_response.rb:48:in `return!': 405 Method Not Allowed (RestClient::MethodNotAllowed)
72
80
 
@@ -77,6 +85,10 @@ Mudbug.new('facebook.com').delete '/'
77
85
  # /path/to/lib/restclient/abstract_response.rb:39:in `return!': 301 Moved Permanently (RestClient::MovedPermanently)
78
86
  ```
79
87
 
88
+ Command Line
89
+ ------------
90
+ An executable [mb](https://github.com/rickhull/mudbug/blob/master/bin/mb) is provided. It wants arguments HOST, METHOD, PATH, PAYLOAD. A persistent configuration system is provided via `dotcfg`, such that you can provide default values for some arguments and only specify the remaining arguments on the command line.
91
+
80
92
  Digging Deeper
81
93
  --------------
82
94
  Call Mudbug#resource directly for finer-grained response handling:
File without changes
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.8.1.3
1
+ 0.8.2.1
data/bin/mb CHANGED
@@ -13,9 +13,11 @@ if ARGV.delete '--debug'
13
13
  end
14
14
 
15
15
  def checkpoint(msg)
16
- et = sprintf("%0.2f", Time.now - $LAST_CHECKPOINT)
16
+ if $VERBOSE
17
+ et = sprintf("%0.2f", Time.now - $LAST_CHECKPOINT)
18
+ puts "#{msg} in #{et} seconds"
19
+ end
17
20
  $LAST_CHECKPOINT = Time.now
18
- puts "#{msg} in #{et} seconds" if $VERBOSE
19
21
  end
20
22
 
21
23
  #####################
data/doc/mb.md ADDED
@@ -0,0 +1,25 @@
1
+ mb
2
+ ==
3
+
4
+ Today:
5
+ ```
6
+ mb config host 10.0.0.1
7
+ mb config method get
8
+ mb config path /foo
9
+ mb
10
+
11
+ # or
12
+
13
+ mb config host 10.0.0.1
14
+ mb get /foo
15
+ ```
16
+
17
+ Tomorrow:
18
+ ```
19
+ mb config --host 10.0.0.1 --method get --path /foo
20
+ mb config --host=10.0.0.1 --method=get --path=/foo
21
+ mb config -h 10.0.0.1 -m get -p /foo
22
+ mb config -h10.0.0.1 -mget -p/foo
23
+ ```
24
+ If `mb config` can do it, then `mb` can do it.
25
+ `mb config` is for storing a persistent default via `dotcfg`
data/mudbug.gemspec CHANGED
@@ -11,17 +11,25 @@ Gem::Specification.new do |s|
11
11
 
12
12
  s.add_runtime_dependency "rest-client", "~> 1"
13
13
  s.add_runtime_dependency "json", "~> 1"
14
- s.add_runtime_dependency "lager", ">= 0.2"
14
+ s.add_runtime_dependency "lager", "~> 1"
15
15
  s.add_runtime_dependency "dotcfg", "~> 0.2"
16
- s.add_development_dependency "minitest", ">= 0"
17
- s.add_development_dependency "buildar", "~> 1.4"
16
+ s.add_development_dependency "minitest", "~> 1"
17
+ s.add_development_dependency "buildar", "~> 2.0"
18
18
 
19
- # dynamic setup
19
+ # set version dynamically from version file contents
20
20
  this_dir = File.expand_path('..', __FILE__)
21
21
  version_file = File.join(this_dir, 'VERSION')
22
- manifest_file = File.join(this_dir, 'MANIFEST.txt')
23
-
24
- # dynamic assignments
25
22
  s.version = File.read(version_file).chomp
26
- s.files = File.readlines(manifest_file).map { |f| f.chomp }
23
+
24
+ s.files = %w[
25
+ mudbug.gemspec
26
+ VERSION
27
+ README.md
28
+ Rakefile
29
+ lib/mudbug.rb
30
+ test/mudbug.rb
31
+ examples/accepts_and_methods.rb
32
+ bin/mb
33
+ doc/mb.md
34
+ ]
27
35
  end
data/test/mudbug.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'minitest/spec'
2
2
  require 'minitest/autorun'
3
3
 
4
- require_relative '../lib/mudbug'
4
+ # require_relative '../lib/mudbug'
5
5
 
6
6
  describe "Mudbug" do
7
7
  it "has no tests" do
metadata CHANGED
@@ -1,99 +1,99 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mudbug
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1.3
4
+ version: 0.8.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rick Hull
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-05 00:00:00.000000000 Z
11
+ date: 2014-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1'
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
26
  version: '1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: json
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: lager
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ! '>='
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0.2'
47
+ version: '1'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ! '>='
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0.2'
54
+ version: '1'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: dotcfg
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0.2'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0.2'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: minitest
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ! '>='
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
75
+ version: '1'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ! '>='
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0'
82
+ version: '1'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: buildar
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ~>
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '1.4'
89
+ version: '2.0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ~>
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '1.4'
96
+ version: '2.0'
97
97
  description: GET, POST, PUT, and DELETE JSON payloads. Easy Accept headers. Fine-grained
98
98
  response handling using Mudbug#resource.
99
99
  email:
@@ -102,16 +102,15 @@ executables:
102
102
  extensions: []
103
103
  extra_rdoc_files: []
104
104
  files:
105
- - mudbug.gemspec
106
- - MANIFEST.txt
107
- - VERSION
108
105
  - README.md
109
- - LICENSE.txt
110
- - rakefile.rb
106
+ - Rakefile
107
+ - VERSION
108
+ - bin/mb
109
+ - doc/mb.md
110
+ - examples/accepts_and_methods.rb
111
111
  - lib/mudbug.rb
112
+ - mudbug.gemspec
112
113
  - test/mudbug.rb
113
- - examples/accepts_and_methods.rb
114
- - bin/mb
115
114
  homepage: http://github.com/rickhull/mudbug
116
115
  licenses:
117
116
  - LGPL
@@ -122,17 +121,17 @@ require_paths:
122
121
  - lib
123
122
  required_ruby_version: !ruby/object:Gem::Requirement
124
123
  requirements:
125
- - - ! '>='
124
+ - - ">="
126
125
  - !ruby/object:Gem::Version
127
126
  version: '0'
128
127
  required_rubygems_version: !ruby/object:Gem::Requirement
129
128
  requirements:
130
- - - ! '>='
129
+ - - ">="
131
130
  - !ruby/object:Gem::Version
132
131
  version: '0'
133
132
  requirements: []
134
133
  rubyforge_project:
135
- rubygems_version: 2.0.6
134
+ rubygems_version: 2.2.2
136
135
  signing_key:
137
136
  specification_version: 4
138
137
  summary: This hardy creature consumes JSON / REST APIs
data/LICENSE.txt DELETED
@@ -1,165 +0,0 @@
1
- GNU LESSER GENERAL PUBLIC LICENSE
2
- Version 3, 29 June 2007
3
-
4
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
- Everyone is permitted to copy and distribute verbatim copies
6
- of this license document, but changing it is not allowed.
7
-
8
-
9
- This version of the GNU Lesser General Public License incorporates
10
- the terms and conditions of version 3 of the GNU General Public
11
- License, supplemented by the additional permissions listed below.
12
-
13
- 0. Additional Definitions.
14
-
15
- As used herein, "this License" refers to version 3 of the GNU Lesser
16
- General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
- General Public License.
18
-
19
- "The Library" refers to a covered work governed by this License,
20
- other than an Application or a Combined Work as defined below.
21
-
22
- An "Application" is any work that makes use of an interface provided
23
- by the Library, but which is not otherwise based on the Library.
24
- Defining a subclass of a class defined by the Library is deemed a mode
25
- of using an interface provided by the Library.
26
-
27
- A "Combined Work" is a work produced by combining or linking an
28
- Application with the Library. The particular version of the Library
29
- with which the Combined Work was made is also called the "Linked
30
- Version".
31
-
32
- The "Minimal Corresponding Source" for a Combined Work means the
33
- Corresponding Source for the Combined Work, excluding any source code
34
- for portions of the Combined Work that, considered in isolation, are
35
- based on the Application, and not on the Linked Version.
36
-
37
- The "Corresponding Application Code" for a Combined Work means the
38
- object code and/or source code for the Application, including any data
39
- and utility programs needed for reproducing the Combined Work from the
40
- Application, but excluding the System Libraries of the Combined Work.
41
-
42
- 1. Exception to Section 3 of the GNU GPL.
43
-
44
- You may convey a covered work under sections 3 and 4 of this License
45
- without being bound by section 3 of the GNU GPL.
46
-
47
- 2. Conveying Modified Versions.
48
-
49
- If you modify a copy of the Library, and, in your modifications, a
50
- facility refers to a function or data to be supplied by an Application
51
- that uses the facility (other than as an argument passed when the
52
- facility is invoked), then you may convey a copy of the modified
53
- version:
54
-
55
- a) under this License, provided that you make a good faith effort to
56
- ensure that, in the event an Application does not supply the
57
- function or data, the facility still operates, and performs
58
- whatever part of its purpose remains meaningful, or
59
-
60
- b) under the GNU GPL, with none of the additional permissions of
61
- this License applicable to that copy.
62
-
63
- 3. Object Code Incorporating Material from Library Header Files.
64
-
65
- The object code form of an Application may incorporate material from
66
- a header file that is part of the Library. You may convey such object
67
- code under terms of your choice, provided that, if the incorporated
68
- material is not limited to numerical parameters, data structure
69
- layouts and accessors, or small macros, inline functions and templates
70
- (ten or fewer lines in length), you do both of the following:
71
-
72
- a) Give prominent notice with each copy of the object code that the
73
- Library is used in it and that the Library and its use are
74
- covered by this License.
75
-
76
- b) Accompany the object code with a copy of the GNU GPL and this license
77
- document.
78
-
79
- 4. Combined Works.
80
-
81
- You may convey a Combined Work under terms of your choice that,
82
- taken together, effectively do not restrict modification of the
83
- portions of the Library contained in the Combined Work and reverse
84
- engineering for debugging such modifications, if you also do each of
85
- the following:
86
-
87
- a) Give prominent notice with each copy of the Combined Work that
88
- the Library is used in it and that the Library and its use are
89
- covered by this License.
90
-
91
- b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
- document.
93
-
94
- c) For a Combined Work that displays copyright notices during
95
- execution, include the copyright notice for the Library among
96
- these notices, as well as a reference directing the user to the
97
- copies of the GNU GPL and this license document.
98
-
99
- d) Do one of the following:
100
-
101
- 0) Convey the Minimal Corresponding Source under the terms of this
102
- License, and the Corresponding Application Code in a form
103
- suitable for, and under terms that permit, the user to
104
- recombine or relink the Application with a modified version of
105
- the Linked Version to produce a modified Combined Work, in the
106
- manner specified by section 6 of the GNU GPL for conveying
107
- Corresponding Source.
108
-
109
- 1) Use a suitable shared library mechanism for linking with the
110
- Library. A suitable mechanism is one that (a) uses at run time
111
- a copy of the Library already present on the user's computer
112
- system, and (b) will operate properly with a modified version
113
- of the Library that is interface-compatible with the Linked
114
- Version.
115
-
116
- e) Provide Installation Information, but only if you would otherwise
117
- be required to provide such information under section 6 of the
118
- GNU GPL, and only to the extent that such information is
119
- necessary to install and execute a modified version of the
120
- Combined Work produced by recombining or relinking the
121
- Application with a modified version of the Linked Version. (If
122
- you use option 4d0, the Installation Information must accompany
123
- the Minimal Corresponding Source and Corresponding Application
124
- Code. If you use option 4d1, you must provide the Installation
125
- Information in the manner specified by section 6 of the GNU GPL
126
- for conveying Corresponding Source.)
127
-
128
- 5. Combined Libraries.
129
-
130
- You may place library facilities that are a work based on the
131
- Library side by side in a single library together with other library
132
- facilities that are not Applications and are not covered by this
133
- License, and convey such a combined library under terms of your
134
- choice, if you do both of the following:
135
-
136
- a) Accompany the combined library with a copy of the same work based
137
- on the Library, uncombined with any other library facilities,
138
- conveyed under the terms of this License.
139
-
140
- b) Give prominent notice with the combined library that part of it
141
- is a work based on the Library, and explaining where to find the
142
- accompanying uncombined form of the same work.
143
-
144
- 6. Revised Versions of the GNU Lesser General Public License.
145
-
146
- The Free Software Foundation may publish revised and/or new versions
147
- of the GNU Lesser General Public License from time to time. Such new
148
- versions will be similar in spirit to the present version, but may
149
- differ in detail to address new problems or concerns.
150
-
151
- Each version is given a distinguishing version number. If the
152
- Library as you received it specifies that a certain numbered version
153
- of the GNU Lesser General Public License "or any later version"
154
- applies to it, you have the option of following the terms and
155
- conditions either of that published version or of any later version
156
- published by the Free Software Foundation. If the Library as you
157
- received it does not specify a version number of the GNU Lesser
158
- General Public License, you may choose any version of the GNU Lesser
159
- General Public License ever published by the Free Software Foundation.
160
-
161
- If the Library as you received it specifies that a proxy can decide
162
- whether future versions of the GNU Lesser General Public License shall
163
- apply, that proxy's public statement of acceptance of any version is
164
- permanent authorization for you to choose that version for the
165
- Library.
data/MANIFEST.txt DELETED
@@ -1,10 +0,0 @@
1
- mudbug.gemspec
2
- MANIFEST.txt
3
- VERSION
4
- README.md
5
- LICENSE.txt
6
- rakefile.rb
7
- lib/mudbug.rb
8
- test/mudbug.rb
9
- examples/accepts_and_methods.rb
10
- bin/mb