Class: Sysdig::CreateUser

Inherits:
Request
  • Object
show all
Defined in:
lib/sysdig/create_user.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.paramsObject



2
3
4
# File 'lib/sysdig/create_user.rb', line 2

def self.params
  %w[username]
end

Instance Method Details

#mock(alert) ⇒ Object

}



141
142
143
144
145
146
147
148
149
150
151
# File 'lib/sysdig/create_user.rb', line 141

def mock(alert)
  alert_id = service.serial_id
  body     = Cistern::Hash.slice(Cistern::Hash.stringify_keys(alert), *self.class.params)

  service.data[:alerts][alert_id] = body.merge!("id" => alert_id)

  service.response(
    :status => 201,
    :body   => {"alert" => body},
  )
end

#real(email) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/sysdig/create_user.rb', line 6

def real(email)
  service.request(
    :method => :post,
    :path   => "/api/users", # https://app.sysdigcloud.com/api/users
    :body   => { "username" => email },
  )
end