Sha256: 6d6dd0f86ee4cc38c98326105917f20e5ef70a8230828b005cd1789dbe8ea7e8

Contents?: true

Size: 528 Bytes

Versions: 1

Compression:

Stored size: 528 Bytes

Contents

module TrackerApi
  module Endpoints
    class Projects
      attr_accessor :client

      def initialize(client)
        @client = client
      end

      def get(params={})
        data = client.request(
            method: :get,
            path:   '/projects',
            params: params
        ).body
        raise TrackerApi::Errors::UnexpectedData, 'Array of projects expected' unless data.is_a? Array

        data.map { |project| Resources::Project.new({ client: client }.merge(project)) }
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tracker_api-0.1.0 lib/tracker_api/endpoints/projects.rb