Class: CodasetAPI::Ticket
- Defined in:
- lib/codaset/codaset-api.rb
Overview
Find tickets
CodasetAPI::Ticket.find(:all, :params => { :project_id => 44 })
CodasetAPI::Ticket.find(:all, :params => { :project_id => 44, :q => "status:closed" })
project = CodasetAPI::Project.find(44)
project.tickets
project.tickets(:q => "status:closed")
project.tickets(:params => {:status => 'closed'})
Class Method Summary collapse
-
.element_path(id, prefix_options = {}, query_options = nil) ⇒ Object
begin monkey patches.
Instance Method Summary collapse
- #create ⇒ Object
- #element_path(options = nil) ⇒ Object
- #encode(options = {}) ⇒ Object
- #update ⇒ Object
Methods inherited from Base
Class Method Details
.element_path(id, prefix_options = {}, query_options = nil) ⇒ Object
begin monkey patches
191 192 193 194 |
# File 'lib/codaset/codaset-api.rb', line 191 def self.element_path(id, = {}, = nil) , = () if .nil? "#{prefix()}#{collection_name}/#{URI.escape id.to_s}#{query_string()}" end |
Instance Method Details
#create ⇒ Object
214 215 216 217 218 219 |
# File 'lib/codaset/codaset-api.rb', line 214 def create connection.post(collection_path + '?' + encode, nil, self.class.headers).tap do |response| self.id = id_from_response(response) load_attributes_from_response(response) end end |
#element_path(options = nil) ⇒ Object
196 197 198 |
# File 'lib/codaset/codaset-api.rb', line 196 def element_path( = nil) self.class.element_path(self.id, ) end |
#encode(options = {}) ⇒ Object
200 201 202 203 204 205 206 |
# File 'lib/codaset/codaset-api.rb', line 200 def encode(={}) val = [] attributes.each_pair do |key, value| val << "values[#{URI.escape key}]=#{URI.escape value}" rescue nil end val.join('&') end |
#update ⇒ Object
208 209 210 211 212 |
# File 'lib/codaset/codaset-api.rb', line 208 def update connection.put(element_path() + '?' + encode, nil, self.class.headers).tap do |response| load_attributes_from_response(response) end end |