Sha256: 585a3cdac3c5e284f6eb3bc6d9509871644b480010e535a248cb6b82ce450661
Contents?: true
Size: 799 Bytes
Versions: 1
Compression:
Stored size: 799 Bytes
Contents
module MooMoo class Response # Constructor # # ==== Required # * <tt>:hash</tt> - hash of the response # # ==== Optional # * <tt>:key</tt> - primary key to use when indexing the hash def initialize(hash, key = nil) @hash = hash @key = key end # Returns whether or not the command executed was successful # def success? @hash['is_success'].nil? ? true : @hash['is_success'].to_i == 1 end # Returns the error message if one is present # def error_msg @hash['response_text'] end # Returns the response code if one is present # def error_code @hash['response_code'].to_i end # Returns the result hash # def result @key.nil? ? @hash : @hash[@key] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
moo_moo-0.2.0 | lib/moo_moo/response.rb |