Class: MultiVideoStreaming::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/multi_video_streaming/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeResponse

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_errorObject

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

#responseObject

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: message })
  if status == "error"
    @has_error = true
  end

  status
end

#get_all_responseObject



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_responseObject



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