Class: Pingboard::Request
- Inherits:
-
Object
- Object
- Pingboard::Request
- Defined in:
- lib/pingboard/request.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#client ⇒ Object
Returns the value of attribute client.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#http_verb ⇒ Object
Returns the value of attribute http_verb.
-
#params ⇒ Object
Returns the value of attribute params.
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
- #do ⇒ Object
-
#initialize(client:, http_verb:, path:, headers:, body:, params: {}) ⇒ Request
constructor
A new instance of Request.
Constructor Details
#initialize(client:, http_verb:, path:, headers:, body:, params: {}) ⇒ Request
Returns a new instance of Request.
6 7 8 9 10 11 12 13 |
# File 'lib/pingboard/request.rb', line 6 def initialize(client:, http_verb:, path:, headers:, body:, params: {}) @client = client @http_verb = http_verb @path = path @headers = headers @body = body @params = params end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
4 5 6 |
# File 'lib/pingboard/request.rb', line 4 def body @body end |
#client ⇒ Object
Returns the value of attribute client.
4 5 6 |
# File 'lib/pingboard/request.rb', line 4 def client @client end |
#headers ⇒ Object
Returns the value of attribute headers.
4 5 6 |
# File 'lib/pingboard/request.rb', line 4 def headers @headers end |
#http_verb ⇒ Object
Returns the value of attribute http_verb.
4 5 6 |
# File 'lib/pingboard/request.rb', line 4 def http_verb @http_verb end |
#params ⇒ Object
Returns the value of attribute params.
4 5 6 |
# File 'lib/pingboard/request.rb', line 4 def params @params end |
#path ⇒ Object
Returns the value of attribute path.
4 5 6 |
# File 'lib/pingboard/request.rb', line 4 def path @path end |
Instance Method Details
#do ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/pingboard/request.rb', line 15 def do @client.connection.public_send(@http_verb) do |request| request.url "#{@path}" set_headers!(request) if headers set_body!(request) if body set_params!(request) if params end end |