Class: StubRequests::Endpoint
- Includes:
- Comparable, ArgumentValidation
- Defined in:
- lib/stub_requests/endpoint.rb
Overview
Class Endpoint provides registration of stubbed endpoints
Instance Attribute Summary collapse
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #hash ⇒ Object
-
#initialize(endpoint_id, verb, uri_template, default_options = {}) ⇒ Endpoint
constructor
An endpoint for a specific Service.
-
#to_s ⇒ String
Returns a descriptive string of this endpoint.
-
#update(verb, uri_template, default_options) ⇒ Endpoint
Updates this endpoint.
Methods included from ArgumentValidation
Constructor Details
#initialize(endpoint_id, verb, uri_template, default_options = {}) ⇒ Endpoint
An endpoint for a specific Service
50 51 52 53 54 55 56 57 58 59 |
# File 'lib/stub_requests/endpoint.rb', line 50 def initialize(endpoint_id, verb, uri_template, = {}) validate! endpoint_id, is_a: Symbol validate! verb, is_a: Symbol validate! uri_template, is_a: String @id = endpoint_id @verb = verb @uri_template = uri_template @default_options = end |
Instance Attribute Details
#default_options ⇒ Object
36 37 38 |
# File 'lib/stub_requests/endpoint.rb', line 36 def @default_options end |
#uri_template ⇒ Object
30 31 32 |
# File 'lib/stub_requests/endpoint.rb', line 30 def uri_template @uri_template end |
Instance Method Details
#<=>(other) ⇒ Object
81 82 83 |
# File 'lib/stub_requests/endpoint.rb', line 81 def <=>(other) id <=> other.id end |
#hash ⇒ Object
85 86 87 |
# File 'lib/stub_requests/endpoint.rb', line 85 def hash [id, self.class].hash end |
#to_s ⇒ String
Returns a descriptive string of this endpoint
96 97 98 |
# File 'lib/stub_requests/endpoint.rb', line 96 def to_s "#<#{self.class} id=:#{id} verb=:#{verb} uri_template='#{uri_template}'>" end |
#update(verb, uri_template, default_options) ⇒ Endpoint
Updates this endpoint
74 75 76 77 78 79 |
# File 'lib/stub_requests/endpoint.rb', line 74 def update(verb, uri_template, ) @verb = verb @uri_template = uri_template @default_options = self end |