Class: Tracksale::DummyClient
- Inherits:
-
Object
- Object
- Tracksale::DummyClient
- Defined in:
- lib/tracksale/dummy_client.rb
Class Attribute Summary collapse
-
.response ⇒ Object
Easy way to force a response.
Instance Method Summary collapse
- #default_response_object ⇒ Object
-
#get(_endpoint_path, _extra_headers = {}) ⇒ Object
maintaining the same method signature as the real client.
-
#initialize ⇒ DummyClient
constructor
A new instance of DummyClient.
-
#post(_endpoint_path, _body, _extra_headers = {}) ⇒ Object
maintaining the same method signature as the real client.
- #response ⇒ Object
Constructor Details
#initialize ⇒ DummyClient
Returns a new instance of DummyClient.
7 8 9 |
# File 'lib/tracksale/dummy_client.rb', line 7 def initialize puts 'running tracksale dummy client, do not expect real responses.' if $DEBUG end |
Class Attribute Details
.response ⇒ Object
Easy way to force a response
4 5 6 |
# File 'lib/tracksale/dummy_client.rb', line 4 def response @response end |
Instance Method Details
#default_response_object ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/tracksale/dummy_client.rb', line 21 def default_response_object response = {} def response.success? true end response end |
#get(_endpoint_path, _extra_headers = {}) ⇒ Object
maintaining the same method signature as the real client
12 13 14 |
# File 'lib/tracksale/dummy_client.rb', line 12 def get(_endpoint_path, _extra_headers = {}) response end |
#post(_endpoint_path, _body, _extra_headers = {}) ⇒ Object
maintaining the same method signature as the real client
17 18 19 |
# File 'lib/tracksale/dummy_client.rb', line 17 def post(_endpoint_path, _body, _extra_headers = {}) response end |
#response ⇒ Object
31 32 33 34 |
# File 'lib/tracksale/dummy_client.rb', line 31 def response # definies a default valid response unless explicity defined. self.class.response || default_response_object end |