Sha256: d0635886e67fa8a63ea08da5609c4b9599df5821d480347bf84055d69ba55fad

Contents?: true

Size: 731 Bytes

Versions: 1

Compression:

Stored size: 731 Bytes

Contents

require_relative "resource"

module Mirror
  module Api
    class Client

      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 timeline
        @timeline ||= Resource.new(@credentials)
      end

      def subscriptions
        @subscriptions ||= Resource.new(@credentials, Request::SUBSCRIPTIONS)
      end

      def locations
        @locations ||= Resource.new(@credentials, Request::LOCATIONS)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mirror-api-0.0.6 lib/mirror-api/client.rb