Class: Twingly::LiveFeed::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/twingly/livefeed/result.rb

Overview

Represents a result from a request to the LiveFeed API

See Also:

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#first_postTime

the index time for the first post in the result

Returns:

  • (Time)

    the current value of first_post



18
19
20
# File 'lib/twingly/livefeed/result.rb', line 18

def first_post
  @first_post
end

#fromTime

the timestamp that was sent in the request. See Client#timestamp

Returns:

  • (Time)

    the current value of from



18
19
20
# File 'lib/twingly/livefeed/result.rb', line 18

def from
  @from
end

#last_postTime

the index time for the last post in the result

Returns:

  • (Time)

    the current value of last_post



18
19
20
# File 'lib/twingly/livefeed/result.rb', line 18

def last_post
  @last_post
end

#max_number_of_postsInteger

the maximum number of posts this result could contain. See Client#max_posts

Returns:

  • (Integer)

    the current value of max_number_of_posts



18
19
20
# File 'lib/twingly/livefeed/result.rb', line 18

def max_number_of_posts
  @max_number_of_posts
end

#next_timestampTime

the timestamp that should be used to get the next batch of posts

Returns:

  • (Time)

    the current value of next_timestamp



18
19
20
# File 'lib/twingly/livefeed/result.rb', line 18

def next_timestamp
  @next_timestamp
end

#number_of_postsInteger

the number of posts this result contains

Returns:

  • (Integer)

    the current value of number_of_posts



18
19
20
# File 'lib/twingly/livefeed/result.rb', line 18

def number_of_posts
  @number_of_posts
end

#tsTime

the exact time when the result was built

Returns:

  • (Time)

    the current value of ts



18
19
20
# File 'lib/twingly/livefeed/result.rb', line 18

def ts
  @ts
end

Instance Method Details

#inspectObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/twingly/livefeed/result.rb', line 27

def inspect
  instance_methods = [
    "posts",
    "ts=#{self.ts}",
    "from=#{self.from}",
    "number_of_posts=#{self.number_of_posts}",
    "max_number_of_posts=#{self.max_number_of_posts}",
    "first_post=#{self.first_post}",
    "last_post=#{self.last_post}",
    "next_timestamp=#{self.next_timestamp}",
  ].join(", ")

  sprintf("#<%s:0x%x %s>", self.class.name, __id__, instance_methods)
end

#postsArray<Post>

Returns all posts that matched the Query.

Returns:

  • (Array<Post>)

    all posts that matched the Query.



23
24
25
# File 'lib/twingly/livefeed/result.rb', line 23

def posts
  @posts ||= []
end