Sha256: b932cf6b6a37ee31e8ccff4818b6f70274e6264870eccf943f91796a45c9d250

Contents?: true

Size: 1.31 KB

Versions: 1

Compression:

Stored size: 1.31 KB

Contents

# This class is just an intermediate for exporting events to Caren.
# It has the correct format for exports.
class Caren::Event < Caren::Base

  def self.keys
    [ :external_id,       # String Unique identifying string (Your event id)
      :name,              # String
      :comment,           # String
      :start,             # String (14:00)
      :duration,          # Integer
      :reservation,       # Integer
      :valid_from,        # Date
      :valid_to,          # Date
      :person_first_name, # String
      :person_last_name,  # String
      :person_male,       # Boolean
      :billable_id,       # Integer (Caren billable id)
      :billable_amount,   # Integer
      :cancel_before,     # DateTime
      :subject_id,        # Integer (Caren subject id)
      :external_person_id,# String (Your person id)
      :source             # String (remote_schedule,remote_realisation)
    ] + super
  end
  
  def reserve_credits session
    session.post reserve_credits_url, self.to_xml
  end
  
  def release_credits session
    session.post release_credits_url, self.to_xml
  end

  def self.array_root
   :events
  end

  def self.node_root
   :event
  end

  private
  
  def release_credits_url
    "/api/pro/store/release_credits"
  end
  
  def reserve_credits_url
    "/api/pro/store/reserve_credits"
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
caren-api-0.6.7 lib/caren/event.rb