Class: Birdsong::Tweet

Inherits:
Object
  • Object
show all
Defined in:
lib/birdsong/tweet.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#authorObject (readonly) Also known as: user

Returns the value of attribute author.



26
27
28
# File 'lib/birdsong/tweet.rb', line 26

def author
  @author
end

#author_idObject (readonly)

Returns the value of attribute author_id.



25
26
27
# File 'lib/birdsong/tweet.rb', line 25

def author_id
  @author_id
end

#created_atObject (readonly)

Returns the value of attribute created_at.



22
23
24
# File 'lib/birdsong/tweet.rb', line 22

def created_at
  @created_at
end

#idObject (readonly)

Returns the value of attribute id.



21
22
23
# File 'lib/birdsong/tweet.rb', line 21

def id
  @id
end

#image_file_namesObject (readonly)

Returns the value of attribute image_file_names.



27
28
29
# File 'lib/birdsong/tweet.rb', line 27

def image_file_names
  @image_file_names
end

#jsonObject (readonly)

Attributes for after the response is parsed from Twitter



20
21
22
# File 'lib/birdsong/tweet.rb', line 20

def json
  @json
end

#languageObject (readonly)

Returns the value of attribute language.



24
25
26
# File 'lib/birdsong/tweet.rb', line 24

def language
  @language
end

#textObject (readonly)

Returns the value of attribute text.



23
24
25
# File 'lib/birdsong/tweet.rb', line 23

def text
  @text
end

#video_file_namesObject (readonly)

Returns the value of attribute video_file_names.



28
29
30
# File 'lib/birdsong/tweet.rb', line 28

def video_file_names
  @video_file_names
end

#video_file_typeObject (readonly)

Returns the value of attribute video_file_type.



29
30
31
# File 'lib/birdsong/tweet.rb', line 29

def video_file_type
  @video_file_type
end

#video_preview_imageObject (readonly)

Returns the value of attribute video_preview_image.



30
31
32
# File 'lib/birdsong/tweet.rb', line 30

def video_preview_image
  @video_preview_image
end

Class Method Details

.lookup(ids = []) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/birdsong/tweet.rb', line 5

def self.lookup(ids = [])
  # If a single id is passed in we make it the appropriate array
  ids = [ids] unless ids.kind_of?(Array)

  # Check that the ids are at least real ids
  ids.each { |id| raise Birdsong::InvalidIdError if !/\A\d+\z/.match(id) }

  tweet_objects = ids.map { |id| Birdsong::TweetScraper.new.parse(id) }

  tweet_objects.map do |tweet_object|
    Tweet.new(tweet_object)
  end
end