Sha256: e9526579e2c8374892ee552f24d8271a4e9c8351de1ce0c66a238e84ffe4146c

Contents?: true

Size: 1.13 KB

Versions: 21

Compression:

Stored size: 1.13 KB

Contents

class Caren::Link < Caren::Base

  def self.keys
    [:id,               # Integer (Caren id)
     :person_name,      # String (Caren person name)
     :care_provider_id, # Integer
     :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)
    ] + super
  end

  def self.search key, value, session
    from_xml session.get( self.search_url(key,value) )
  end

  def self.find id, session
    from_xml session.get(self.resource_url(id))
  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
    self.class.from_xml session.post(self.resource_url, self.to_xml)
  end

  def as_xml
    { :patient_number => self.patient_number,
      :external_id => self.external_id }
  end

  def self.array_root
    :links
  end

  def self.node_root
    :link
  end

  def self.resource_location
    "/api/pro/links"
  end

end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
caren-api-0.5.16 lib/caren/link.rb
caren-api-0.5.15 lib/caren/link.rb
caren-api-0.5.14 lib/caren/link.rb
caren-api-0.5.13 lib/caren/link.rb
caren-api-0.5.12 lib/caren/link.rb
caren-api-0.5.10 lib/caren/link.rb
caren-api-0.5.9 lib/caren/link.rb
caren-api-0.5.8 lib/caren/link.rb
caren-api-0.5.7 lib/caren/link.rb
caren-api-0.5.6 lib/caren/link.rb
caren-api-0.5.5 lib/caren/link.rb
caren-api-0.5.4 lib/caren/link.rb
caren-api-0.5.3 lib/caren/link.rb
caren-api-0.5.2 lib/caren/link.rb
caren-api-0.5.1 lib/caren/link.rb
caren-api-0.5.0 lib/caren/link.rb
caren-api-0.4.34 lib/caren/link.rb
caren-api-0.4.33 lib/caren/link.rb
caren-api-0.4.32 lib/caren/link.rb
caren-api-0.4.31 lib/caren/link.rb