Sha256: 606dc08fe189fb34bc6f68e540683604a5bdf56dea0f896b1fd53e9f1f1d7850

Contents?: true

Size: 1.07 KB

Versions: 12

Compression:

Stored size: 1.07 KB

Contents

require 'twitter/base'
require 'twitter/creatable'

module Twitter
  module Action
    class Mention < Twitter::Base
      include Twitter::Creatable
      attr_reader :max_position, :min_position

      # A collection of users who mentioned a user
      #
      # @return [Array<Twitter::User>]
      def sources
        @sources = Array(@attrs[:sources]).map do |user|
          Twitter::User.fetch_or_new(user)
        end
      end

      # The user who mentioned a user
      #
      # @return [Twitter::User]
      def source
        @source = sources.first
      end

      # A collection of tweets that mention a user
      #
      # @return [Array<Twitter::Tweet>]
      def target_objects
        @target_objects = Array(@attrs[:target_objects]).map do |tweet|
          Twitter::Tweet.fetch_or_new(tweet)
        end
      end

      # A collection containing the mentioned user
      #
      # @return [Array<Twitter::User>]
      def targets
        @targets = Array(@attrs[:targets]).map do |user|
          Twitter::User.fetch_or_new(user)
        end
      end

    end
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
twitter-4.8.1 lib/twitter/action/mention.rb
twitter-4.8.0 lib/twitter/action/mention.rb
hackeroo-0.1.0 lib/hackeroo/action/mention.rb
twitter-4.7.0 lib/twitter/action/mention.rb
twitter-4.6.2 lib/twitter/action/mention.rb
twitter-4.6.1 lib/twitter/action/mention.rb
twitter-4.6.0 lib/twitter/action/mention.rb
twitter-4.5.0 lib/twitter/action/mention.rb
twitter-4.4.4 lib/twitter/action/mention.rb
twitter-4.4.3 lib/twitter/action/mention.rb
twitter-4.4.2 lib/twitter/action/mention.rb
twitter-4.4.1 lib/twitter/action/mention.rb