Class: SmswayApi::Message::Vcard

Inherits:
SmswayApi::Message show all
Defined in:
lib/smsway_api/message/vcard.rb

Constant Summary

Constants inherited from SmswayApi::Message

TYPES

Instance Attribute Summary

Attributes inherited from SmswayApi::Message

#recepients, #sender, #type

Instance Method Summary collapse

Methods inherited from SmswayApi::Message

#add_recipient

Constructor Details

#initialize(vcard = {}) ⇒ Vcard

allowed options:

url
name
phone
  cell
  work
  fax
email
position
organization
address
   post_office_box
   street
   city
   region
   postal_code
   country
additional


21
22
23
24
# File 'lib/smsway_api/message/vcard.rb', line 21

def initialize(vcard = {})
  super(:vcard)
  @vcard = vcard
end

Instance Method Details

#build(xml, start_index = 0) ⇒ Object



26
27
28
29
30
31
32
33
34
# File 'lib/smsway_api/message/vcard.rb', line 26

def build(xml, start_index = 0)
  super do |xml|
    [:url, :name, :email, :position, :organization, :additional, :phone, :address].each do |key|
      if @vcard.has_key?(key)
        xml.tag!(key, @vcard[key])
      end
    end
  end
end