Sha256: bb1489a81f9553e77cf2f439b08d22353386a7ca8e658be9f2404d19d196d40d

Contents?: true

Size: 970 Bytes

Versions: 3

Compression:

Stored size: 970 Bytes

Contents

require_relative "timeline_request"
require_relative "timeline_item_request"

module Mirror
  module Api
    class Timeline

      def initialize(credentials)
        @credentials =  if credentials.is_a?(String)
          {:token => credentials}
        elsif credentials.is_a?(Hash)
          credentials
        end

        raise "Invalid credentials #{credentials.inspect}" unless @credentials
      end

      def list(params={})
        TimelineRequest.new(params, 200, @credentials).get
      end

      def create(params)
        TimelineRequest.new(params, 201, @credentials).post
      end

      def get(id, params=nil)
        TimelineItemRequest.new(id, params, 200, @credentials).get
      end

      def update(id, params)
        # This may become patch later
        TimelineItemRequest.new(id, params, 200, @credentials).put
      end

      def delete(id)
        TimelineItemRequest.new(id, nil, 200, @credentials).delete
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mirror-api-0.0.4 lib/mirror-api/timeline.rb
mirror-api-0.0.3 lib/mirror-api/timeline.rb
mirror-api-0.0.2 lib/mirror-api/timeline.rb