Class: Wrappi::Request::Template
- Inherits:
-
Object
- Object
- Wrappi::Request::Template
- Defined in:
- lib/wrappi/request/template.rb
Instance Attribute Summary collapse
-
#endpoint ⇒ Object
readonly
Returns the value of attribute endpoint.
Instance Method Summary collapse
- #call ⇒ Object
- #client ⇒ Object
- #http ⇒ Object
-
#initialize(endpoint) ⇒ Template
constructor
A new instance of Template.
- #params ⇒ Object
- #url ⇒ Object
- #verb ⇒ Object
Constructor Details
#initialize(endpoint) ⇒ Template
Returns a new instance of Template.
5 6 7 |
# File 'lib/wrappi/request/template.rb', line 5 def initialize(endpoint) @endpoint = endpoint end |
Instance Attribute Details
#endpoint ⇒ Object (readonly)
Returns the value of attribute endpoint.
4 5 6 |
# File 'lib/wrappi/request/template.rb', line 4 def endpoint @endpoint end |
Instance Method Details
#call ⇒ Object
33 34 35 |
# File 'lib/wrappi/request/template.rb', line 33 def call raise NotImplementedError end |
#client ⇒ Object
9 10 11 |
# File 'lib/wrappi/request/template.rb', line 9 def client endpoint.client end |
#http ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/wrappi/request/template.rb', line 25 def http h = HTTP.timeout(client.timeout) .headers(endpoint.headers) h = h.follow() if endpoint.follow_redirects # TODO: add strict mode h = h.basic_auth(endpoint.basic_auth) if endpoint.basic_auth h end |
#params ⇒ Object
13 14 15 |
# File 'lib/wrappi/request/template.rb', line 13 def params endpoint.consummated_params end |
#url ⇒ Object
17 18 19 |
# File 'lib/wrappi/request/template.rb', line 17 def url endpoint.url end |
#verb ⇒ Object
21 22 23 |
# File 'lib/wrappi/request/template.rb', line 21 def verb endpoint.verb end |