Sha256: 8ae825f9432c445c0d9b50ce774a5910cbd934751ee16e9cc836ac073a147c7f

Contents?: true

Size: 974 Bytes

Versions: 2

Compression:

Stored size: 974 Bytes

Contents

class Caren::Link < Caren::Base
      
  def self.keys
    [:id,             # String (Caren id)
     :person_name,    # String (Caren person name)
     :person_id,      # String (Caren person id)
     :person_photo,   # String (url of photo)
     :patient_number, # String (12345)
     :external_id,    # String (Your person id)
     :status          # String (pending,confirmed,cancelled)
    ]
  end
  
  def self.search key, value, session
    from_xml session.get( self.search_url(key,value) )
  end
  
  def self.all session
    from_xml session.get(self.resource_url)
  end
  
  # Request to create a new link. Example:
  # Caren::Link.new( :patient_number => 1234 ).create
  def create session
    session.post(self.resource_url, self.to_xml)
  end

  def as_xml
    { :patient_number => self.patient_number }
  end
  
  def self.array_root
    :links
  end
  
  def self.node_root
    :link
  end
  
  def self.resource_location
    "/api/links/"
  end
        
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
caren-api-0.4.1 lib/caren/link.rb
caren-api-0.4.0 lib/caren/link.rb