class ActionTexter::Response

A response as sent from the provider.

@abstract @!attribute [r] raw

@return [String] the raw response as returned by the provider

@!attribute success

@return [Boolean] weather sending the message succeeded or not. See #success? and #failed?

@!attribute error_message

@return [String] a descriptive message of the error when an error happened.

Attributes

error_message[R]
raw[R]
success[R]

Public Class Methods

new(raw) click to toggle source
# File lib/action_texter/response.rb, line 16
def initialize(raw)
  @raw = raw
  process_response(raw)
end

Public Instance Methods

failed?() click to toggle source

@return [Boolean] false when sending the message failed, true otherwise.

# File lib/action_texter/response.rb, line 27
def failed?
  !@success
end
success?() click to toggle source

@return [Boolean] true when sending the message succeeded, false otherwise.

# File lib/action_texter/response.rb, line 22
def success?
  !!@success
end
to_s() click to toggle source

@private

# File lib/action_texter/response.rb, line 32
def to_s
  "#<#{self.class.name}:#{object_id}:#{@success ? "success" : "fail"}>"
end

Private Instance Methods

process_response(raw) click to toggle source
# File lib/action_texter/response.rb, line 38
def process_response(raw)
  raise NotImplementedError.new("should be implemented by subclasses")
end