Class: Fleakr::Api::ViewOption

Inherits:
SimpleOption show all
Defined in:
lib/fleakr/api/option.rb

Overview

ViewOption

Specify who is able to view the photo.

Instance Attribute Summary

Attributes inherited from SimpleOption

#type, #value

Instance Method Summary collapse

Constructor Details

#initialize(type, value) ⇒ ViewOption

Specify who this is viewable by (e.g. everyone / friends / family).



86
87
88
# File 'lib/fleakr/api/option.rb', line 86

def initialize(type, value)
  super type, Array(value)
end

Instance Method Details

#family?Boolean

Is this viewable by family? (i.e. :family)

Returns:

  • (Boolean)


104
105
106
# File 'lib/fleakr/api/option.rb', line 104

def family?
  value.include?(:family)
end

#friends?Boolean

Is this viewable by friends? (i.e. :friends)

Returns:

  • (Boolean)


98
99
100
# File 'lib/fleakr/api/option.rb', line 98

def friends?
  value.include?(:friends)
end

#public?Boolean

Is this publicly viewable? (i.e. :everyone)

Returns:

  • (Boolean)


92
93
94
# File 'lib/fleakr/api/option.rb', line 92

def public?
  value == [:everyone]
end

#to_hashObject

Hash representation of photo permissions



110
111
112
# File 'lib/fleakr/api/option.rb', line 110

def to_hash
  {:is_public => public?.to_i, :is_friend => friends?.to_i, :is_family => family?.to_i}
end