Class: RSimpy::BaseService
- Inherits:
-
Object
- Object
- RSimpy::BaseService
- Defined in:
- lib/base_service.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#status_code ⇒ Object
readonly
Returns the value of attribute status_code.
-
#status_message ⇒ Object
readonly
Returns the value of attribute status_message.
-
#success ⇒ Object
readonly
Returns the value of attribute success.
Instance Method Summary collapse
Instance Attribute Details
#status_code ⇒ Object (readonly)
Returns the value of attribute status_code.
3 4 5 |
# File 'lib/base_service.rb', line 3 def status_code @status_code end |
#status_message ⇒ Object (readonly)
Returns the value of attribute status_message.
3 4 5 |
# File 'lib/base_service.rb', line 3 def @status_message end |
#success ⇒ Object (readonly)
Returns the value of attribute success.
3 4 5 |
# File 'lib/base_service.rb', line 3 def success @success end |
Instance Method Details
#execute_using(method, params) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/base_service.rb', line 19 def execute_using method, params reset response = @client.execute method, build_link(params) set_status response response end |
#reset ⇒ Object
5 6 7 8 9 |
# File 'lib/base_service.rb', line 5 def reset @success = false @status_message = nil @status_code = nil end |
#set_status(response) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/base_service.rb', line 11 def set_status response @success = ((response.code == 200) && response['status']['code'] == "0") if response.code == 200 @status_code = response['status']['code'] @status_message = response['status']['message'] end end |