Sha256: 8f3eac2e225a37eea1735a96a71d153ec4a2f8332e7d8cfb6fe6f686a4ff76e2

Contents?: true

Size: 1.13 KB

Versions: 6

Compression:

Stored size: 1.13 KB

Contents

require 'twitter/base'
require 'twitter/tweet'

module Twitter
  class SearchResults < Twitter::Base

    # @return [Array<Twitter::Tweet>]
    def statuses
      @results ||= Array(@attrs[:statuses]).map do |tweet|
        Twitter::Tweet.fetch_or_new(tweet)
      end
    end
    alias collection statuses
    alias results statuses

    # @return [Float]
    def completed_in
      @attrs[:search_metadata][:completed_in] unless @attrs[:search_metadata].nil?
    end

    # @return [Integer]
    def max_id
      @attrs[:search_metadata][:max_id] unless @attrs[:search_metadata].nil?
    end

    # @return [Integer]
    def page
      @attrs[:search_metadata][:page] unless @attrs[:search_metadata].nil?
    end

    # @return [String]
    def query
      @attrs[:search_metadata][:query] unless @attrs[:search_metadata].nil?
    end

    # @return [Integer]
    def results_per_page
      @attrs[:search_metadata][:results_per_page] unless @attrs[:search_metadata].nil?
    end
    alias rpp results_per_page

    # @return [Integer]
    def since_id
      @attrs[:search_metadata][:since_id] unless @attrs[:search_metadata].nil?
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
twitter-4.3.0 lib/twitter/search_results.rb
twitter-4.2.0 lib/twitter/search_results.rb
twitter-4.1.2 lib/twitter/search_results.rb
twitter-4.1.1 lib/twitter/search_results.rb
twitter-4.1.0 lib/twitter/search_results.rb
twitter-4.0.0 lib/twitter/search_results.rb