Module: PivotalTracker

Defined in:
lib/pivotal-tracker.rb,
lib/pivotal-tracker/note.rb,
lib/pivotal-tracker/task.rb,
lib/pivotal-tracker/proxy.rb,
lib/pivotal-tracker/story.rb,
lib/pivotal-tracker/client.rb,
lib/pivotal-tracker/project.rb,
lib/pivotal-tracker/activity.rb,
lib/pivotal-tracker/iteration.rb,
lib/pivotal-tracker/attachment.rb,
lib/pivotal-tracker/membership.rb,
lib/pivotal-tracker/validation.rb

Defined Under Namespace

Modules: Validation Classes: Activity, Attachment, Client, Errors, Iteration, Membership, Note, Project, ProjectNotSpecified, Proxy, Story, Task

Class Method Summary collapse

Class Method Details

.encode_options(options) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/pivotal-tracker.rb', line 25

def self.encode_options(options)
  options_strings = options.inject({}) do |m, (k,v)|
    if [:limit, :offset].include?(k.to_sym)
      m.update k => 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