Sha256: 20658b9677d9e9c3d5254ed6f98b2310014a6a3ae838a0614ff9dc6ab52961ec

Contents?: true

Size: 771 Bytes

Versions: 4

Compression:

Stored size: 771 Bytes

Contents

##
# NPR::Entity::Audio
#
module NPR
  module Entity
    class Audio < Base
      attr_accessor :id, :type, :stream
      shallow_attribute "title", "duration", "description", "rightsHolder"
      has_one "permissions", :class_name => NPR::Entity::Permissions
      has_one "formats", :key => "format", :class_name => NPR::Entity::Formats
      
      #-------------------
      # +stream+ returns true if "active" is set to "true"
      # 
      def initialize(json)
        @id   = json["id"].to_i
        @type = json["type"]
                
        if json["stream"]
          @stream = json["stream"]["active"] == "true"
        end
        
        create_relations(json)
        extract_shallow_attributes(json)
      end
    end # Audio
  end # Entity
end # NPR

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
npr-1.1.0 lib/npr/entity/audio.rb
npr-0.1.2 lib/npr/entity/audio.rb
npr-0.1.1 lib/npr/entity/audio.rb
npr-0.1.0 lib/npr/entity/audio.rb