class MusicTodayApiWrapper::RestClients::CommonResponse

Attributes

data[RW]
errors[RW]

Public Class Methods

new(data = {}, errors = []) click to toggle source
# File lib/rest_clients/common_response.rb, line 6
def initialize(data = {}, errors = [])
  @data = data
  @errors = errors
end

Public Instance Methods

success?() click to toggle source
# File lib/rest_clients/common_response.rb, line 19
def success?
  @errors.empty?
end
work() { || ... } click to toggle source
# File lib/rest_clients/common_response.rb, line 11
def work
  yield
  self
rescue StandardError => error
  @errors.push(error.message)
  self
end