class KakaoPush::Response
Attributes
body[RW]
raw_body[RW]
status[RW]
Public Class Methods
new(faraday_response)
click to toggle source
# File lib/kakao_push/response.rb, line 8 def initialize(faraday_response) self.raw_body = faraday_response.body self.status = faraday_response.status self.body = MultiJson.load(raw_body) if raw_body && !raw_body.empty? end
Public Instance Methods
data()
click to toggle source
# File lib/kakao_push/response.rb, line 22 def data success? ? body : nil end
error_code()
click to toggle source
# File lib/kakao_push/response.rb, line 26 def error_code return if success? body['code'] if body.is_a?(Hash) && body.has_key?('code') end
error_message()
click to toggle source
# File lib/kakao_push/response.rb, line 31 def error_message return if success? body['msg'] if body.is_a?(Hash) && body.has_key?('msg') end
fail?()
click to toggle source
# File lib/kakao_push/response.rb, line 18 def fail? !success? end
success?()
click to toggle source
# File lib/kakao_push/response.rb, line 14 def success? status == 200 end
to_s()
click to toggle source
# File lib/kakao_push/response.rb, line 36 def to_s <<-EOS KakaoPush::Response status : #{status} success? : #{success?} fail? : #{fail?} data : #{data} error_code : #{error_code} error_message : #{error_message} EOS end