Sha256: 2a32567a1e4cfd0c7c823cf276ec60d2631d8b06012a48e08d594be62dd79410

Contents?: true

Size: 821 Bytes

Versions: 2

Compression:

Stored size: 821 Bytes

Contents

module Marver
  class Event
    include Marver::Summarizable
    include Marver::Commonable

    attr_reader :json, :title, :resource_uri,
                :description, :start, :end, :next, :previous

    class << self
      def build(results)
        if results.kind_of?(Array)
          results.collect do |event|
            Marver::Event.new(event)
          end
        else
          new(results)
        end
      end
    end

    def initialize(json)
      @json = json

      @title = @json['title']
      @resource_uri = @json['resourceURI']

      @description = @json['description']
      @start = DateTime.parse(@json['start'])
      @end = DateTime.parse(@json['end'])
      @next = Marver::Summary::Event.new(@json['next'])
      @previous = Marver::Summary::Event.new(@json['previous'])
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
marver-0.0.6 lib/marver/entities/event.rb
marver-0.0.5 lib/marver/entities/event.rb