Class: Aceroute::Location
Instance Attribute Summary collapse
-
#address1 ⇒ Object
Returns the value of attribute address1.
-
#address2 ⇒ Object
Returns the value of attribute address2.
-
#cid ⇒ Object
Returns the value of attribute cid.
-
#description ⇒ Object
Returns the value of attribute description.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#phone ⇒ Object
Returns the value of attribute phone.
Class Method Summary collapse
-
.delete(id) ⇒ Object
Deletes Aceroute::Location of given id from Aceroute.
Instance Method Summary collapse
-
#create! ⇒ Aceroute::Location
Persists Aceroute::Location object to Aceroute API.
-
#destroy!(id = nil) ⇒ Object
Deletes this Aceroute::Location object (self) from Aceroute.
-
#initialize(address1, address2, description, name, phone, cid = nil, id = nil) ⇒ Aceroute::Location
constructor
Creates a new Aceroute::Location object.
Constructor Details
#initialize(address1, address2, description, name, phone, cid = nil, id = nil) ⇒ Aceroute::Location
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
#address1 ⇒ Object
Returns the value of attribute address1.
3 4 5 |
# File 'lib/aceroute/location.rb', line 3 def address1 @address1 end |
#address2 ⇒ Object
Returns the value of attribute address2.
4 5 6 |
# File 'lib/aceroute/location.rb', line 4 def address2 @address2 end |
#cid ⇒ Object
Returns the value of attribute cid.
8 9 10 |
# File 'lib/aceroute/location.rb', line 8 def cid @cid end |
#description ⇒ Object
Returns the value of attribute description.
5 6 7 |
# File 'lib/aceroute/location.rb', line 5 def description @description end |
#id ⇒ Object
Returns the value of attribute id.
8 9 10 |
# File 'lib/aceroute/location.rb', line 8 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/aceroute/location.rb', line 6 def name @name end |
#phone ⇒ Object
Returns the value of attribute phone.
7 8 9 |
# File 'lib/aceroute/location.rb', line 7 def phone @phone end |
Class Method Details
.delete(id) ⇒ Object
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
#create! ⇒ Aceroute::Location
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 |