Sha256: 4ee33c6218192852366cf595f139b9fab2aa9f23d4a1846b7d7ef14723643494

Contents?: true

Size: 725 Bytes

Versions: 1

Compression:

Stored size: 725 Bytes

Contents

require 'rest-client'

module Slurper
  class Client
    CREATE_STORY_URL = "https://www.pivotaltracker.com/services/v5/projects/#{Slurper::Config.project_id}/stories"
    USERS_URL        = "https://www.pivotaltracker.com/services/v5/projects/#{Slurper::Config.project_id}/memberships"

    def self.create(story)
      result = RestClient.post(
        CREATE_STORY_URL,
        story.to_json,
        {
          "Content-Type" => "application/json",
          "X-TrackerToken" => Slurper::Config.token
        }
      )

      return result
    end

    def self.users
      JSON.parse(RestClient.get(
        USERS_URL,
        { "X-TrackerToken" => Slurper::Config.token }
      ).try(:body) || '[]')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
slurper-2.2.2 lib/slurper/client.rb