class Twitter::TrendResults

Attributes

attrs[R]

@return [Hash]

to_h[R]

@return [Hash]

to_hash[R]

@return [Hash]

Public Class Methods

new(attrs = {}) click to toggle source

Initializes a new TrendResults object

@param attrs [Hash] @return [Twitter::TrendResults]

# File lib/twitter/trend_results.rb, line 23
def initialize(attrs = {})
  @attrs = attrs
  @collection = @attrs.fetch(:trends, []).collect do |trend|
    Trend.new(trend)
  end
end

Public Instance Methods

as_of() click to toggle source

Time when the object was created on Twitter

@return [Time]

# File lib/twitter/trend_results.rb, line 33
def as_of
  Time.parse(@attrs[:as_of]) unless @attrs[:as_of].nil?
end
as_of?() click to toggle source
# File lib/twitter/trend_results.rb, line 38
def as_of?
  !!@attrs[:as_of]
end
location() click to toggle source

@return [Twitter::Place, NullObject]

# File lib/twitter/trend_results.rb, line 44
def location
  location? ? Place.new(@attrs[:locations].first) : NullObject.new
end
location?() click to toggle source

@return [Boolean]

# File lib/twitter/trend_results.rb, line 50
def location?
  !@attrs[:locations].nil? && !@attrs[:locations].first.nil?
end