Sha256: 39dc474c6d252823b00adb4da0c646c0c13d8181d725d0c038af3af50901a036
Contents?: true
Size: 987 Bytes
Versions: 2
Compression:
Stored size: 987 Bytes
Contents
module MuthofunApi class Result def initialize(response) @response = Hash.from_xml(response || '') || {smslist: {sms: {}, error: {}}} end def output @response.deep_symbolize_keys! end def success? !failed? end def failed? output[:smslist].present? && output[:smslist][:error].present? end def sms_client_id output[:smslist][:sms][:mobile_no] if success? end def message_id output[:smslist][:sms][:messageid] if success? end def mobile output[:smslist][:sms][:mobile_no] if success? end def error_description output[:smslist][:error][:error_description] if failed? end def error_code output[:smslist][:error][:error_code] if failed? end def error { description: output[:smslist][:error][:error_description], error_code: output[:smslist][:error][:error_code] } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
muthofun_api-0.1.3 | lib/muthofun_api/result.rb |
muthofun_api-0.1.2 | lib/muthofun_api/result.rb |