Class: Fleakr::Objects::PhotoContext

Inherits:
Object
  • Object
show all
Includes:
Support::Object
Defined in:
lib/fleakr/objects/photo_context.rb

Overview

PhotoContext

This class represents the context for a photo as retrieved from the API. It’s not intended to be used directly, but is used in conjunction with Photo#previous and Photo#next

Attributes

count

The number of photos available

Instance Method Summary collapse

Methods included from Support::Object

included

Instance Method Details

#nextObject

The next photo if one is available



42
43
44
# File 'lib/fleakr/objects/photo_context.rb', line 42

def next
  Photo.find_by_id(next_id) if next?
end

#next?Boolean

Is there a next photo available for the current photo?

Returns:

  • (Boolean)


36
37
38
# File 'lib/fleakr/objects/photo_context.rb', line 36

def next?
  next_id != '0'
end

#previousObject

The previous photo if one is available



30
31
32
# File 'lib/fleakr/objects/photo_context.rb', line 30

def previous
  Photo.find_by_id(previous_id) if previous?
end

#previous?Boolean

Is there a previous photo available for the current photo?

Returns:

  • (Boolean)


24
25
26
# File 'lib/fleakr/objects/photo_context.rb', line 24

def previous?
  previous_id != '0'
end