Sha256: f4b79167f5b8c3fd23af3ff8855ed87c6860645ee004daca599dab335adc3c47

Contents?: true

Size: 1.31 KB

Versions: 2

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 reserve_credits_url
    "/api/pro/store/credits/reserve"
  end
  
  def release_credits_url
    "/api/pro/store/credits/release"
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
caren-api-0.6.9 lib/caren/event.rb
caren-api-0.6.8 lib/caren/event.rb