Class: MultiVideoStreaming::Response
- Inherits:
-
Object
- Object
- MultiVideoStreaming::Response
- Defined in:
- lib/multi_video_streaming/response.rb
Instance Attribute Summary collapse
-
#has_error ⇒ Object
readonly
Returns the value of attribute has_error.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
- #add_response(platform_name:, status:, original_status_code:, data:, params_equivalent: nil, message:) ⇒ Object
- #get_all_response ⇒ Object
- #get_this_response ⇒ Object
-
#initialize ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize ⇒ Response
Returns a new instance of Response.
82 83 84 85 |
# File 'lib/multi_video_streaming/response.rb', line 82 def initialize() @response = [] @has_error = false end |
Instance Attribute Details
#has_error ⇒ Object
Returns the value of attribute has_error.
79 80 81 |
# File 'lib/multi_video_streaming/response.rb', line 79 def has_error @has_error end |
#response ⇒ Object
Returns the value of attribute response.
76 77 78 |
# File 'lib/multi_video_streaming/response.rb', line 76 def response @response end |
Instance Method Details
#add_response(platform_name:, status:, original_status_code:, data:, params_equivalent: nil, message:) ⇒ Object
87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/multi_video_streaming/response.rb', line 87 def add_response(platform_name:, status:, original_status_code:, data:, params_equivalent: nil, message:) if params_equivalent response_data = format_data(data: data, params_equivalent: params_equivalent) else response_data = data end @response.push({ platform_name: platform_name, status: status, original_status_code: original_status_code, data: response_data, message: }) if status == "error" @has_error = true end status end |
#get_all_response ⇒ Object
106 107 108 |
# File 'lib/multi_video_streaming/response.rb', line 106 def get_all_response MultiVideoStreaming::FinalResponse.new(has_error: has_error, response: @response) end |
#get_this_response ⇒ Object
102 103 104 |
# File 'lib/multi_video_streaming/response.rb', line 102 def get_this_response MultiVideoStreaming::FinalResponse.new(has_error: has_error, response: @response.last) end |