Class: Flukso::Request
- Inherits:
-
Object
- Object
- Flukso::Request
- Extended by:
- Forwardable
- Includes:
- HTTParty
- Defined in:
- lib/flukso/request.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Class Method Summary collapse
- .delete(client, path, options = {}) ⇒ Object
- .get(client, path, options = {}) ⇒ Object
- .post(client, path, options = {}) ⇒ Object
- .put(client, path, options = {}) ⇒ Object
Instance Method Summary collapse
-
#initialize(client, method, path, options = {}) ⇒ Request
constructor
A new instance of Request.
- #perform ⇒ Object
- #uri ⇒ Object
Constructor Details
#initialize(client, method, path, options = {}) ⇒ Request
Returns a new instance of Request.
47 48 49 |
# File 'lib/flukso/request.rb', line 47 def initialize(client, method, path, ={}) @client, @method, @path, @options = client, method, path, {:mash => true}.merge() end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
43 44 45 |
# File 'lib/flukso/request.rb', line 43 def client @client end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
43 44 45 |
# File 'lib/flukso/request.rb', line 43 def method @method end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
43 44 45 |
# File 'lib/flukso/request.rb', line 43 def @options end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
43 44 45 |
# File 'lib/flukso/request.rb', line 43 def path @path end |
Class Method Details
.delete(client, path, options = {}) ⇒ Object
39 40 41 |
# File 'lib/flukso/request.rb', line 39 def self.delete(client, path, ={}) new(client, :delete, path, ).perform end |
.get(client, path, options = {}) ⇒ Object
27 28 29 |
# File 'lib/flukso/request.rb', line 27 def self.get(client, path, ={}) new(client, :get, path, ).perform end |
.post(client, path, options = {}) ⇒ Object
31 32 33 |
# File 'lib/flukso/request.rb', line 31 def self.post(client, path, ={}) new(client, :post, path, ).perform end |
.put(client, path, options = {}) ⇒ Object
35 36 37 |
# File 'lib/flukso/request.rb', line 35 def self.put(client, path, ={}) new(client, :put, path, ).perform end |
Instance Method Details
#perform ⇒ Object
63 64 65 |
# File 'lib/flukso/request.rb', line 63 def perform make_friendly(send("perform_#{method}")) end |
#uri ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/flukso/request.rb', line 51 def uri @uri ||= begin uri = URI.parse(path) if [:query] && [:query] != {} uri.query = to_query([:query]) end uri.to_s end end |