Sha256: 11173b7c895d0b682f34acd028cf2038cbf932ccd36dfb148691cda72dbb8821

Contents?: true

Size: 1.63 KB

Versions: 1

Compression:

Stored size: 1.63 KB

Contents

require 'cgi'
require 'rest_client'
require 'happymapper' # nokogiri-happymapper
require 'nokogiri'
require 'crack'

require File.join(File.dirname(__FILE__), 'pivotal-tracker', 'validation')
require File.join(File.dirname(__FILE__), 'pivotal-tracker', 'extensions')
require File.join(File.dirname(__FILE__), 'pivotal-tracker', 'proxy')
require File.join(File.dirname(__FILE__), 'pivotal-tracker', 'client')
require File.join(File.dirname(__FILE__), 'pivotal-tracker', 'project')
require File.join(File.dirname(__FILE__), 'pivotal-tracker', 'attachment')
require File.join(File.dirname(__FILE__), 'pivotal-tracker', 'story')
require File.join(File.dirname(__FILE__), 'pivotal-tracker', 'task')
require File.join(File.dirname(__FILE__), 'pivotal-tracker', 'membership')
require File.join(File.dirname(__FILE__), 'pivotal-tracker', 'activity')
require File.join(File.dirname(__FILE__), 'pivotal-tracker', 'iteration')
require File.join(File.dirname(__FILE__), 'pivotal-tracker', 'note')
require File.join(File.dirname(__FILE__), 'pivotal-tracker', 'version')

module PivotalTracker

  # define error types
  class ProjectNotSpecified < StandardError; end

  def self.encode_options(options)
    options_strings = options.inject({}) do |m, (k,v)|
      if [:limit, :offset].include?(k.to_sym)
        m.update k => v
      elsif k.to_sym == :search
        m.update :filter => v
      else
        filter_query = %{#{k}:#{[v].flatten.join(",")}}
        m.update :filter => (m[:filter] ? "#{m[:filter]} #{filter_query}" : filter_query)
      end
    end.map {|k,v| "#{k}=#{CGI.escape(v.to_s)}"}

    %{?#{options_strings.join("&")}} unless options_strings.empty?
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pivotal-tracker-0.5.13 lib/pivotal-tracker.rb