Sha256: 47214a327bbc1b0a52b0b38b758832eedc25607abd72e211c7eaabd7f0850874

Contents?: true

Size: 857 Bytes

Versions: 1

Compression:

Stored size: 857 Bytes

Contents

require 'twitter/default'
require 'twitter/tweet'

module Twitter
  module API
    # @note Inspired from gems\twitter-4.5.0\spec\twitter\api\timelines_spec.rb
    module Timelines

      # Get some user timeline by screen name
      #
      # @example
      #   user_timeline('DolarBlue', count: 1)
      #
      def user_timeline(screen_name, opts)
        # Sanitize arguments
        count = opts[:count] || 1
        screen_name = screen_name.to_s
        # Work out
        results = get_user_timeline_results(screen_name, count)
        Twitter::Tweet.build_tweets(results)
      end

      private

      def get_user_timeline_results(screen_name, count)
        path = "statuses/user_timeline.json"
        qry = []
        qry << ['screen_name', screen_name]
        qry << ['count', count.to_s]
        get(path, qry)
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
twitter_anonymous_client-0.0.1 lib/twitter/api/timelines.rb