Class: Tick::Entry
Constant Summary collapse
- XML_PROPERTIES =
%w( id billable billed budget client_name created_at date hours notes project_name sum_hours task_id task_name updated_at user_email user_id )
Instance Attribute Summary collapse
-
#billable ⇒ Object
Returns the value of attribute billable.
-
#billed ⇒ Object
Returns the value of attribute billed.
-
#budget ⇒ Object
Returns the value of attribute budget.
-
#client_name ⇒ Object
Returns the value of attribute client_name.
-
#date ⇒ Object
Returns the value of attribute date.
-
#hours ⇒ Object
Returns the value of attribute hours.
-
#notes ⇒ Object
Returns the value of attribute notes.
-
#project_name ⇒ Object
Returns the value of attribute project_name.
-
#sum_hours ⇒ Object
Returns the value of attribute sum_hours.
-
#task_id ⇒ Object
Returns the value of attribute task_id.
-
#task_name ⇒ Object
Returns the value of attribute task_name.
-
#user_email ⇒ Object
Returns the value of attribute user_email.
-
#user_id ⇒ Object
Returns the value of attribute user_id.
Attributes inherited from Base
#api_name, #api_path, #created_at, #id, #updated_at
Class Method Summary collapse
Methods inherited from Base
api_name, list, #set_properties_from_xml_node
Instance Attribute Details
#billable ⇒ Object
Returns the value of attribute billable.
4 5 6 |
# File 'lib/tick/entry.rb', line 4 def billable @billable end |
#billed ⇒ Object
Returns the value of attribute billed.
4 5 6 |
# File 'lib/tick/entry.rb', line 4 def billed @billed end |
#budget ⇒ Object
Returns the value of attribute budget.
4 5 6 |
# File 'lib/tick/entry.rb', line 4 def budget @budget end |
#client_name ⇒ Object
Returns the value of attribute client_name.
4 5 6 |
# File 'lib/tick/entry.rb', line 4 def client_name @client_name end |
#date ⇒ Object
Returns the value of attribute date.
4 5 6 |
# File 'lib/tick/entry.rb', line 4 def date @date end |
#hours ⇒ Object
Returns the value of attribute hours.
4 5 6 |
# File 'lib/tick/entry.rb', line 4 def hours @hours end |
#notes ⇒ Object
Returns the value of attribute notes.
4 5 6 |
# File 'lib/tick/entry.rb', line 4 def notes @notes end |
#project_name ⇒ Object
Returns the value of attribute project_name.
4 5 6 |
# File 'lib/tick/entry.rb', line 4 def project_name @project_name end |
#sum_hours ⇒ Object
Returns the value of attribute sum_hours.
4 5 6 |
# File 'lib/tick/entry.rb', line 4 def sum_hours @sum_hours end |
#task_id ⇒ Object
Returns the value of attribute task_id.
4 5 6 |
# File 'lib/tick/entry.rb', line 4 def task_id @task_id end |
#task_name ⇒ Object
Returns the value of attribute task_name.
4 5 6 |
# File 'lib/tick/entry.rb', line 4 def task_name @task_name end |
#user_email ⇒ Object
Returns the value of attribute user_email.
4 5 6 |
# File 'lib/tick/entry.rb', line 4 def user_email @user_email end |
#user_id ⇒ Object
Returns the value of attribute user_id.
4 5 6 |
# File 'lib/tick/entry.rb', line 4 def user_id @user_id end |
Class Method Details
.api_path ⇒ Object
11 12 13 |
# File 'lib/tick/entry.rb', line 11 def self.api_path "/api/entries" end |
.create(options = {}, &block) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/tick/entry.rb', line 15 def self.create(={}, &block) url = "https://#{current_session.company}.tickspot.com/api/create_entry" params = { email: current_session.email, password: current_session.password }.merge!() if params[:date].is_a?(NSDate) dateFormatter = NSDateFormatter.new dateFormatter.setDateFormat(DATE_FORMAT) params[:date] = dateFormatter.stringFromDate(params[:date]) end request_manager.GET(url, parameters:params, success:lambda{|operation, result| error = Pointer.new(:object) xml = GDataXMLDocument.alloc.initWithXMLString(result.to_s, error:error) # Create the entry object from xml error = Pointer.new(:object) entry_node = xml.nodesForXPath("//entry", error:error).first entry = new entry.set_properties_from_xml_node(entry_node) block.call(entry) if block }, failure:lambda{|operation, error| block.call(error) if block }) self end |