Class: FormatResponse
- Inherits:
-
Struct
- Object
- Struct
- FormatResponse
- Defined in:
- lib/format_response.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
-
#response ⇒ Object
Returns the value of attribute response.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options
1 2 3 |
# File 'lib/format_response.rb', line 1 def @options end |
#response ⇒ Object
Returns the value of attribute response
1 2 3 |
# File 'lib/format_response.rb', line 1 def response @response end |
Class Method Details
.call(*args) ⇒ Object
3 4 5 |
# File 'lib/format_response.rb', line 3 def self.call(*args) new(*args).call end |
Instance Method Details
#call ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/format_response.rb', line 7 def call formated_json = JSON.pretty_generate(response) if response['status'] == 500 || response['status'] == 403 puts Rainbow(formated_json).red exit else puts Rainbow(formated_json).green if [:verbose] end end |