Class: Aceroute::Order
Instance Attribute Summary (collapse)
-
- (Object) cid
Returns the value of attribute cid.
-
- (Object) customer
in msec (not sec) since epoch.
-
- (Object) description
any freeform text here.
-
- (Object) duration
any freeform text here.
-
- (Object) id
Returns the value of attribute id.
-
- (Object) location
in msec (not sec) since epoch.
-
- (Object) purchase_order
any freeform text here.
-
- (Object) scheduled
any freeform text here.
-
- (Object) start_time
in msec (not sec) since epoch.
-
- (Object) summary
any freeform text here.
-
- (Object) worker
any freeform text here.
Class Method Summary (collapse)
-
+ (Object) delete(id)
Deletes Aceroute::Location of given id from Aceroute.
Instance Method Summary (collapse)
-
- (Aceroute::Order) create!
Persists Aceroute::Order object to Aceroute API.
-
- (Object) destroy!(id = nil)
Deletes this Aceroute::Order object (self) from Aceroute.
-
- (Aceroute::Order) initialize(customer, location, start_time, description = nil, duration = 10, scheduled = true, worker = nil, summary = nil, purchase_order = nil)
constructor
Creates a new Aceroute::Order object.
Constructor Details
- (Aceroute::Order) initialize(customer, location, start_time, description = nil, duration = 10, scheduled = true, worker = nil, summary = nil, purchase_order = nil)
Creates a new Aceroute::Order object. Note this does not persist the Location to Aceroute, that can be done by calling the create! method on the new object.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/aceroute/order.rb', line 24 def initialize(customer, location, start_time, description = nil, duration = 10, scheduled = true, worker = nil, summary = nil, purchase_order = nil) self.customer = customer self.location = location self.start_time = start_time #FIXME: taking a DateTime argument is friendlier #self.start_time = start_time.to_i * 1000 #DateTime object self.description = description self.duration = duration self.scheduled = scheduled self.worker = worker self.summary = summary self.purchase_order = purchase_order end |
Instance Attribute Details
- (Object) cid
Returns the value of attribute cid
5 6 7 |
# File 'lib/aceroute/order.rb', line 5 def cid @cid end |
- (Object) customer
in msec (not sec) since epoch
3 4 5 |
# File 'lib/aceroute/order.rb', line 3 def customer @customer end |
- (Object) description
any freeform text here
4 5 6 |
# File 'lib/aceroute/order.rb', line 4 def description @description end |
- (Object) duration
any freeform text here
4 5 6 |
# File 'lib/aceroute/order.rb', line 4 def duration @duration end |
- (Object) id
Returns the value of attribute id
5 6 7 |
# File 'lib/aceroute/order.rb', line 5 def id @id end |
- (Object) location
in msec (not sec) since epoch
3 4 5 |
# File 'lib/aceroute/order.rb', line 3 def location @location end |
- (Object) purchase_order
any freeform text here
4 5 6 |
# File 'lib/aceroute/order.rb', line 4 def purchase_order @purchase_order end |
- (Object) scheduled
any freeform text here
4 5 6 |
# File 'lib/aceroute/order.rb', line 4 def scheduled @scheduled end |
- (Object) start_time
in msec (not sec) since epoch
3 4 5 |
# File 'lib/aceroute/order.rb', line 3 def start_time @start_time end |
- (Object) summary
any freeform text here
4 5 6 |
# File 'lib/aceroute/order.rb', line 4 def summary @summary end |
- (Object) worker
any freeform text here
4 5 6 |
# File 'lib/aceroute/order.rb', line 4 def worker @worker end |
Class Method Details
+ (Object) delete(id)
Deletes Aceroute::Location of given id from Aceroute
73 74 75 76 77 |
# File 'lib/aceroute/order.rb', line 73 def self.delete(id) req = "<data><del><id>#{id}</id></del></data>" ret = Aceroute::call_api("order.delete", req) ret.success == "true" ? true : false #maybe raise error here instead end |
Instance Method Details
- (Aceroute::Order) create!
Persists Aceroute::Order object to Aceroute API.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/aceroute/order.rb', line 43 def create! recs = "<data> <event> <cid>#{self.customer.cid}</cid> <nm>#{self.description}</nm> <dur>#{self.duration}</dur> <schd>#{self.scheduled ? 1 : 0}</schd> <start_epoch>#{self.start_time}</start_epoch> <lid>#{self.location.id}</lid> <cntid>#{0}</cntid> <rid>#{self.worker}</rid> <dtl>#{self.summary}</dtl> <po>#{self.purchase_order}</po> </event> </data>" data = Aceroute::call_api("order.create", recs) order = data.event update_attrs(order) return self end |
- (Object) destroy!(id = nil)
Deletes this Aceroute::Order object (self) from Aceroute
66 67 68 |
# File 'lib/aceroute/order.rb', line 66 def destroy!(id = nil) Order.delete(id ? id : self.id) end |