Class: Grendel::Client
- Inherits:
-
Object
- Object
- Grendel::Client
- Defined in:
- lib/grendel/client.rb
Defined Under Namespace
Classes: HTTPException
Instance Attribute Summary collapse
-
#base_uri ⇒ Object
readonly
Returns the value of attribute base_uri.
-
#debug ⇒ Object
Returns the value of attribute debug.
-
#debug_output ⇒ Object
Returns the value of attribute debug_output.
Instance Method Summary collapse
- #delete(uri, options = {}) ⇒ Object
- #get(uri, options = {}) ⇒ Object
- #head(uri, options = {}) ⇒ Object
-
#initialize(base_uri, options = {}) ⇒ Client
constructor
Create a new Grendel client instance.
- #post(uri, data = {}, options = {}) ⇒ Object
- #put(uri, data = {}, options = {}) ⇒ Object
- #users ⇒ Object
Constructor Details
#initialize(base_uri, options = {}) ⇒ Client
Create a new Grendel client instance
8 9 10 11 12 |
# File 'lib/grendel/client.rb', line 8 def initialize(base_uri, = {}) @base_uri = base_uri @debug = [:debug] @debug_output = [:debug_output] || $stderr end |
Instance Attribute Details
#base_uri ⇒ Object (readonly)
Returns the value of attribute base_uri.
5 6 7 |
# File 'lib/grendel/client.rb', line 5 def base_uri @base_uri end |
#debug ⇒ Object
Returns the value of attribute debug.
4 5 6 |
# File 'lib/grendel/client.rb', line 4 def debug @debug end |
#debug_output ⇒ Object
Returns the value of attribute debug_output.
4 5 6 |
# File 'lib/grendel/client.rb', line 4 def debug_output @debug_output end |
Instance Method Details
#delete(uri, options = {}) ⇒ Object
30 31 32 |
# File 'lib/grendel/client.rb', line 30 def delete(uri, = {}) process_response HTTParty.delete(@base_uri + uri, ()) end |
#get(uri, options = {}) ⇒ Object
14 15 16 |
# File 'lib/grendel/client.rb', line 14 def get(uri, = {}) process_response HTTParty.get(@base_uri + uri, ()) end |
#head(uri, options = {}) ⇒ Object
18 19 20 |
# File 'lib/grendel/client.rb', line 18 def head(uri, = {}) process_response HTTParty.head(@base_uri + uri, ()) end |
#post(uri, data = {}, options = {}) ⇒ Object
22 23 24 |
# File 'lib/grendel/client.rb', line 22 def post(uri, data = {}, = {}) process_response HTTParty.post(@base_uri + uri, (, data)) end |
#put(uri, data = {}, options = {}) ⇒ Object
26 27 28 |
# File 'lib/grendel/client.rb', line 26 def put(uri, data = {}, = {}) process_response HTTParty.put(@base_uri + uri, (, data)) end |
#users ⇒ Object
34 35 36 |
# File 'lib/grendel/client.rb', line 34 def users UserManager.new(self) end |