Class: Fleakr::Api::ViewOption
- Inherits:
-
SimpleOption
- Object
- SimpleOption
- Fleakr::Api::ViewOption
- Defined in:
- lib/fleakr/api/option.rb
Overview
ViewOption
Specify who is able to view the photo.
Instance Attribute Summary
Attributes inherited from SimpleOption
Instance Method Summary collapse
-
#family? ⇒ Boolean
Is this viewable by family? (i.e. :family).
-
#friends? ⇒ Boolean
Is this viewable by friends? (i.e. :friends).
-
#initialize(type, value) ⇒ ViewOption
constructor
Specify who this is viewable by (e.g. everyone / friends / family).
-
#public? ⇒ Boolean
Is this publicly viewable? (i.e. :everyone).
-
#to_hash ⇒ Object
Hash representation of photo permissions.
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)
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)
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)
92 93 94 |
# File 'lib/fleakr/api/option.rb', line 92 def public? value == [:everyone] end |
#to_hash ⇒ Object
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 |