Class: PupilfirstXapi::Objects::Builder

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

Instance Method Summary collapse

Constructor Details

#initialize(id:, name:, description:, type:) ⇒ Builder

Returns a new instance of Builder.



4
5
6
7
8
9
10
11
# File 'lib/pupilfirst_xapi/objects/builder.rb', line 4

def initialize(id:, name:, description:, type:)
  @params = {
    id: id,
    name: name,
    description: description,
    type: type
  }
end

Instance Method Details

#callObject



19
20
21
# File 'lib/pupilfirst_xapi/objects/builder.rb', line 19

def call
  Xapi.create_activity(@params)
end

#with_extension(type, value) ⇒ Object



13
14
15
16
17
# File 'lib/pupilfirst_xapi/objects/builder.rb', line 13

def with_extension(type, value)
  @params[:extensions] ||= {}
  @params[:extensions].merge!({type => value})
  self
end