Class: Telesign::API::TeleBureau

Inherits:
Rest
  • Object
show all
Defined in:
lib/telesign.rb

Overview

The Telebureau class exposes services for creating, retrieving, updating and deleting telebureau fraud events. You can use this mechanism to simply test whether you can reach telebureau services.

Instance Method Summary collapse

Methods inherited from Rest

#execute, #generate_auth_headers

Constructor Details

#initialize(customer_id, secret_key, ssl = true, api_host = 'rest.telesign.com', timeout = nil) ⇒ TeleBureau



331
332
333
334
335
336
337
338
339
340
341
342
# File 'lib/telesign.rb', line 331

def initialize(customer_id,
               secret_key,
               ssl=true,
               api_host='rest.telesign.com',
               timeout=nil)

  super(customer_id,
        secret_key,
        ssl,
        api_host,
        timeout)
end

Instance Method Details

#create(phone_number, fraud_type, occurred_at, extra = nil, timeout = nil) ⇒ Object

Creates a telebureau event corresponding to supplied data.



345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
# File 'lib/telesign.rb', line 345

def create(phone_number,
           fraud_type,
           occurred_at,
           extra=nil,
           timeout=nil)

  params = {:phone_number => phone_number,
            :fraud_type => fraud_type,
            :occurred_at => occurred_at}

  unless extra.nil?
    params.merge!(extra)
  end

  execute(Net::HTTP::Post,
          "/v1/telebureau/event",
          nil,
          params,
          timeout)
end

#delete(reference_id, extra = nil, timeout = nil) ⇒ Object

Deletes a previously submitted fraud event. You make this call in your web application after completion of the create transaction for a telebureau event.



387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
# File 'lib/telesign.rb', line 387

def delete(reference_id,
           extra=nil,
           timeout=nil)

  params = {}

  unless extra.nil?
    params.merge!(extra)
  end

  execute(Net::HTTP::Delete,
          "/v1/telebureau/event/#{reference_id}",
          params,
          nil,
          timeout)
end

#retrieve(reference_id, extra = nil, timeout = nil) ⇒ Object

Retrieves the fraud event status. You make this call in your web application after completion of create transaction for a telebureau event.



368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
# File 'lib/telesign.rb', line 368

def retrieve(reference_id,
             extra=nil,
             timeout=nil)

  params = {}

  unless extra.nil?
    params.merge!(extra)
  end

  execute(Net::HTTP::Get,
          "/v1/telebureau/event/#{reference_id}",
          params,
          nil,
          timeout)
end