Class: CPS::Contact

Inherits:
Object
  • Object
show all
Defined in:
lib/cps-client/contact.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Contact

Returns a new instance of Contact.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/cps-client/contact.rb', line 8

def initialize(options = {})
  @object       = options[:object].upcase
  @firstname    = options[:firstname] rescue nil
  @lastname     = options[:lastname]  rescue nil
  @orgname      = options[:orgname].nil? || options[:orgname] == "" ? "-" : options[:orgname] rescue nil
  @street       = options[:street]    rescue nil
  @postal       = options[:postal]    rescue nil
  @city         = options[:city]      rescue nil
  @state        = options[:state]     rescue nil
  @iso_country  = options[:iso_country].upcase  rescue nil
  @phone        = options[:phone]     rescue nil
  @fax          = options[:fax]       rescue nil
  @email        = options[:email].to_punycode       rescue nil
  @privacy_rule = options[:privacy_rule] || ""
  @contact_type = @orgname == '-' ? "person" : "organisation"
end

Instance Attribute Details

#objectObject (readonly)

Returns the value of attribute object.



6
7
8
# File 'lib/cps-client/contact.rb', line 6

def object
  @object
end

Instance Method Details

#createObject



29
30
31
# File 'lib/cps-client/contact.rb', line 29

def create
  ErbHelper.build("contact_create", self)
end

#deleteObject



37
38
39
# File 'lib/cps-client/contact.rb', line 37

def delete
  ErbHelper.build("contact_delete", self)
end

#domainObject



41
42
43
# File 'lib/cps-client/contact.rb', line 41

def domain
  ErbHelper.build("contact_domain", self)
end

#get_bindingObject

this is only a helper method to access the objects binding method



46
47
48
# File 'lib/cps-client/contact.rb', line 46

def get_binding
  binding
end

#infoObject



25
26
27
# File 'lib/cps-client/contact.rb', line 25

def info
  ErbHelper.build("contact_info", self)
end

#replaceObject



33
34
35
# File 'lib/cps-client/contact.rb', line 33

def replace
  ErbHelper.build("contact_replace", self)
end