Sha256: a4fe3e8129e36aa81450e110b888840bb94f2031bf356fd2b394128431ca8e70

Contents?: true

Size: 642 Bytes

Versions: 5

Compression:

Stored size: 642 Bytes

Contents

module Gnip
  class SystemMessage < Gnip::Message
    attr_reader :message, :sent, :message_type

    def initialize params
      @raw = params
      @message_type = params.keys.first
      @message = params['message']
      @sent = params['sent']
    end

    def original_attributes
      {
        @message_type => @message,
        :sent => @sent
      }
    end

    def log_method
      @message_type.to_sym
    end

    def message
      @message.strip
    end
    
    def to_json
      @raw.to_json
    end

    def log!
      GnipApi.logger.warn "System Message Received: #{message_type} -- #{message} at #{sent}"
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
gnip_api-1.2.4 lib/gnip_api/gnip/system_message.rb
gnip_api-1.2.3 lib/gnip_api/gnip/system_message.rb
gnip_api-1.2.2 lib/gnip_api/gnip/system_message.rb
gnip_api-1.2.1 lib/gnip_api/gnip/system_message.rb
gnip_api-1.2.0 lib/gnip_api/gnip/system_message.rb