Class: Aceroute::Location
Instance Attribute Summary (collapse)
-
- (Object) address1
Returns the value of attribute address1.
-
- (Object) address2
Returns the value of attribute address2.
-
- (Object) cid
Returns the value of attribute cid.
-
- (Object) description
Returns the value of attribute description.
-
- (Object) id
Returns the value of attribute id.
-
- (Object) name
Returns the value of attribute name.
-
- (Object) phone
Returns the value of attribute phone.
Class Method Summary (collapse)
-
+ (Object) delete(id)
Deletes Aceroute::Location of given id from Aceroute.
Instance Method Summary (collapse)
-
- (Aceroute::Location) create!
Persists Aceroute::Location object to Aceroute API.
-
- (Object) destroy!(id = nil)
Deletes this Aceroute::Location object (self) from Aceroute.
-
- (Aceroute::Location) initialize(address1, address2, description, name, phone, cid = nil, id = nil)
constructor
Creates a new Aceroute::Location object.
Constructor Details
- (Aceroute::Location) initialize(address1, address2, description, name, phone, cid = nil, id = nil)
Creates a new Aceroute::Location object. Note this does not persist the Location to Aceroute, that can be done by calling the create! method on the new object.
22 23 24 25 26 27 28 29 30 |
# File 'lib/aceroute/location.rb', line 22 def initialize(address1, address2, description, name, phone, cid = nil, id= nil) self.address1 = address1 self.address2 = address2 self.description = description self.name = name self.phone = phone self.cid = cid self.id = id end |
Instance Attribute Details
- (Object) address1
Returns the value of attribute address1
3 4 5 |
# File 'lib/aceroute/location.rb', line 3 def address1 @address1 end |
- (Object) address2
Returns the value of attribute address2
4 5 6 |
# File 'lib/aceroute/location.rb', line 4 def address2 @address2 end |
- (Object) cid
Returns the value of attribute cid
8 9 10 |
# File 'lib/aceroute/location.rb', line 8 def cid @cid end |
- (Object) description
Returns the value of attribute description
5 6 7 |
# File 'lib/aceroute/location.rb', line 5 def description @description end |
- (Object) id
Returns the value of attribute id
8 9 10 |
# File 'lib/aceroute/location.rb', line 8 def id @id end |
- (Object) name
Returns the value of attribute name
6 7 8 |
# File 'lib/aceroute/location.rb', line 6 def name @name end |
- (Object) phone
Returns the value of attribute phone
7 8 9 |
# File 'lib/aceroute/location.rb', line 7 def phone @phone end |
Class Method Details
+ (Object) delete(id)
Deletes Aceroute::Location of given id from Aceroute
55 56 57 58 59 |
# File 'lib/aceroute/location.rb', line 55 def self.delete(id) req = "<data><del><id>#{id}</id></del></data>" ret = Aceroute::call_api("customer.location.delete", req) ret.success == "true" ? true : false #maybe raise error here instead end |
Instance Method Details
- (Aceroute::Location) create!
Persists Aceroute::Location object to Aceroute API.
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/aceroute/location.rb', line 35 def create! recs = "<data><loc><id>0</id> <cid>#{self.cid}</cid> <nm>#{self.description}</nm> <adr>#{self.address1}</adr> <adr2>#{self.address2}</adr2> </loc></data>" data = Aceroute::call_api("customer.location.save", recs) loc = data.loc update_attrs(loc) return self end |
- (Object) destroy!(id = nil)
Deletes this Aceroute::Location object (self) from Aceroute
49 50 51 |
# File 'lib/aceroute/location.rb', line 49 def destroy!(id = nil) Location.delete(id ? id : self.id) end |