Sha256: 01d6a413a8f5365cb92dff0e5e8d2f96033cccc0fb09be8c594e639f690da0c0
Contents?: true
Size: 908 Bytes
Versions: 14
Compression:
Stored size: 908 Bytes
Contents
module T2Airtime class Reply def initialize(reply) @response = Hash(reply) end def data hash = {} @response[:body].lines.each do |line| key, value = line.strip.split "=" hash[key.to_sym] = (key == "error_code") ? Integer(value) : value end; hash end def information data.reject do |key, value| [:authentication_key, :error_code, :error_txt].include?(key) end end def success?() status == 200 && error_code == 0 end def status() @response[:status] end def error_code() data[:error_code] end def error_message() data[:error_txt] end def url() "#{@response[:url]}" end def message() information[:info_txt] end def auth_key() data[:authentication_key] end def headers() @response[:response_headers] end def raw() @response[:body] end end end
Version data entries
14 entries across 14 versions & 1 rubygems