Class: NPR::Entity::Permissions

Inherits:
Base
  • Object
show all
Defined in:
lib/npr/entity/permissions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Concern::ShallowAttributes

included

Methods included from Concern::Relation

included

Constructor Details

#initialize(json) ⇒ Permissions

Returns a new instance of Permissions.



11
12
13
14
15
# File 'lib/npr/entity/permissions.rb', line 11

def initialize(json)
  @download = json["download"]["allow"] == "true" if json["download"]
  @stream   = json["stream"]["allow"]   == "true" if json["stream"]
  @embed    = json["embed"]["allow"]    == "true" if json["embed"]
end

Instance Attribute Details

#downloadObject

Returns the value of attribute download.



9
10
11
# File 'lib/npr/entity/permissions.rb', line 9

def download
  @download
end

#embedObject

Returns the value of attribute embed.



9
10
11
# File 'lib/npr/entity/permissions.rb', line 9

def embed
  @embed
end

#streamObject

Returns the value of attribute stream.



9
10
11
# File 'lib/npr/entity/permissions.rb', line 9

def stream
  @stream
end

Instance Method Details

#download?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/npr/entity/permissions.rb', line 18

def download?
  !!@download
end

#embed?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/npr/entity/permissions.rb', line 26

def embed?
  !!@embed
end

#stream?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/npr/entity/permissions.rb', line 22

def stream?
  !!@stream
end