Sha256: d91c7cb29b57f29ac9a1131da628cce4b32b2aec7db90accd5776a97fcb98acd

Contents?: true

Size: 732 Bytes

Versions: 1

Compression:

Stored size: 732 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

1 entries across 1 versions & 1 rubygems

Version Path
npr-1.2.0 lib/npr/entity/audio.rb