Sha256: 04307fe5298b1026cc4ef2478b466d4c06010b351fcbc0d0d8daaf88c976616c

Contents?: true

Size: 525 Bytes

Versions: 6

Compression:

Stored size: 525 Bytes

Contents

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

    def initialize 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
      parse_json(original_attributes)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
gnip_api-0.0.7 lib/gnip_api/gnip/system_message.rb
gnip_api-0.0.6 lib/gnip_api/gnip/system_message.rb
gnip_api-0.0.5 lib/gnip_api/gnip/system_message.rb
gnip_api-0.0.4 lib/gnip_api/gnip/system_message.rb
gnip_api-0.0.3 lib/gnip_api/gnip/system_message.rb
gnip_api-0.0.2 lib/gnip_api/gnip/system_message.rb