Sha256: 2283e9499d24d43b60c870641051a4632d5c77fc361406ca6a55a5465e3d5212
Contents?: true
Size: 812 Bytes
Versions: 2
Compression:
Stored size: 812 Bytes
Contents
module PlayTime class Runner class IOError < StandardError; end class ResponseError < StandardError; end class << self def run!(client, options = {}) response = client.execute(options) if error?(response) raise error_for(response) else response end end private def has_data?(response) response && response.data end def error?(response) !has_data?(response) || response.data['error'] end def error_message(response) response.data['error'] if has_data?(response) end def error_for(response) if error_message = error_message(response) ResponseError.new(error_message) else IOError end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
play_time-0.0.2 | lib/play_time/runner.rb |
play_time-0.0.1 | lib/play_time/runner.rb |