Class: ConstantContact::Components::Component
  
  
  
  
  
    - Inherits:
- 
      Object
      
        
          - Object
- ConstantContact::Components::Component
 show all
    - Defined in:
- lib/constantcontact/components/component.rb
 
  Direct Known Subclasses
  AccountAddress, AccountInfo, Activity, ActivityError, AddContacts, AddContactsImportData, Address, BounceActivity, Campaign, CampaignPreview, ClickActivity, ClickThroughDetails, Contact, ContactList, CustomField, EmailAddress, Event, EventFee, EventItem, EventItemAttribute, EventSpot::Contact, EventSpot::EventAddress, EventSpot::EventTrack, EventSpot::Guest, EventSpot::GuestSection, EventSpot::NotificationOption, EventSpot::OnlineMeeting, EventSpot::PaymentAddress, EventSpot::PaymentSummary, EventSpot::RegistrantFee, EventSpot::RegistrantField, EventSpot::RegistrantOrder, EventSpot::RegistrantPromoCode, EventSpot::RegistrantPromoCodeInfo, EventSpot::RegistrantSection, EventSpot::SaleItem, ExportContacts, ForwardActivity, LibraryFile, LibraryFolder, LibrarySummary, MessageFooter, MoveResults, Note, OpenActivity, Promocode, Registrant, Schedule, SendActivity, TestSend, TrackingActivity, TrackingSummary, UnsubscribeActivity, UploadStatus, VerifiedEmailAddress
 
  
    
      Class Method Summary
      collapse
    
    
  
    
      Instance Method Summary
      collapse
    
    
  
  
    Class Method Details
    
      
  
  
    .to_hash_value(val)  ⇒ Object 
  
  
  
  
    | 
19
20
21
22
23
24
25
26
27
28
29 | # File 'lib/constantcontact/components/component.rb', line 19
def self.to_hash_value(val)
  if val.is_a? ConstantContact::Components::Component
    return val.to_hash
  elsif val.is_a? Array
    return val.collect{|subval| Component.to_hash_value(subval) }
  elsif val.is_a? DateTime
    return val.to_s
  else
    return val
  end
end | 
 
    
   
  
    Instance Method Details
    
      
  
  
    #to_hash  ⇒ Object 
  
  
  
  
    | 
11
12
13
14
15
16
17 | # File 'lib/constantcontact/components/component.rb', line 11
def to_hash
  hash = Hash.new
  self.instance_variables.collect do |var|
    hash[var.to_s[1..-1]] = self.class.to_hash_value(self.instance_variable_get(var))
  end
  hash
end | 
 
    
      
  
  
    #to_json(val = nil)  ⇒ Object 
  
  
  
  
    | 
31
32
33 | # File 'lib/constantcontact/components/component.rb', line 31
def to_json(val = nil)
  self.to_hash.to_json
end |