Class: PupilfirstXapi::Lrs

Inherits:
Object
  • Object
show all
Defined in:
lib/pupilfirst_xapi/lrs.rb

Instance Method Summary collapse

Constructor Details

#initialize(end_point: ENV['LRS_ENDPOINT'], key: ENV['LRS_KEY'], secret: ENV['LRS_SECRET']) ⇒ Lrs

Returns a new instance of Lrs.



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/pupilfirst_xapi/lrs.rb', line 5

def initialize(
  end_point: ENV['LRS_ENDPOINT'],
  key: ENV['LRS_KEY'],
  secret: ENV['LRS_SECRET']
)
  @lrs = end_point && key && secret &&
    Xapi.create_remote_lrs(
      end_point: end_point,
      user_name: key,
      password: secret
    )
end

Instance Method Details

#call(statement) ⇒ Object



18
19
20
21
22
# File 'lib/pupilfirst_xapi/lrs.rb', line 18

def call(statement)
  return unless statement && @lrs

  Xapi.post_statement(remote_lrs: @lrs, statement: statement)
end