Class: Pfapi::PageformantAPI

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key, passwd) ⇒ PageformantAPI

Returns a new instance of PageformantAPI.



21
22
23
24
25
26
27
# File 'lib/pfapi.rb', line 21

def initialize(key, passwd)
  @apiKey = key
  @apiPasswd = passwd
  @lastError = nil

  self
end

Instance Attribute Details

#lastErrorObject

Returns the value of attribute lastError.



19
20
21
# File 'lib/pfapi.rb', line 19

def lastError
  @lastError
end

Instance Method Details

#sendMessage(srvID, message, link, userSpecID = nil) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/pfapi.rb', line 29

def sendMessage(srvID, message, link, userSpecID = nil)
  @lastError = nil

  params = defaultParams
  params['METHOD'] = 'PostMessage'
  params['SERVICEID'] = srvID.to_s
  params['MESSAGE'] = message
  params['LINK'] = link
  params['USERSPECID'] = 
    if userSpecID.nil?
      ''
    else
      userSpecID.to_s
    end

  begin
    sendAPIRequest(params)
  rescue => err
    @lastError = PageformantException.new(err.message)
  end

  @lastError.nil?
end