Class: Gupshup::REST::UserEvents

Inherits:
WhatsApp
  • Object
show all
Defined in:
lib/gupshup_whatsapp/rest/whatsapp/user-event/user-event.rb

Instance Attribute Summary collapse

Attributes inherited from WhatsApp

#path, #phone

Instance Method Summary collapse

Constructor Details

#initialize(app, apikey, version = '2') ⇒ UserEvents

Returns a new instance of UserEvents.



9
10
11
12
# File 'lib/gupshup_whatsapp/rest/whatsapp/user-event/user-event.rb', line 9

def initialize(app, apikey, version = '2')
  super
  @headers = { 'apikey' => @apikey }
end

Instance Attribute Details

#apikeyObject

Returns the value of attribute apikey.



7
8
9
# File 'lib/gupshup_whatsapp/rest/whatsapp/user-event/user-event.rb', line 7

def apikey
  @apikey
end

#appObject

Returns the value of attribute app.



7
8
9
# File 'lib/gupshup_whatsapp/rest/whatsapp/user-event/user-event.rb', line 7

def app
  @app
end

#base_uriObject

Returns the value of attribute base_uri.



7
8
9
# File 'lib/gupshup_whatsapp/rest/whatsapp/user-event/user-event.rb', line 7

def base_uri
  @base_uri
end

#content_typeObject

Returns the value of attribute content_type.



7
8
9
# File 'lib/gupshup_whatsapp/rest/whatsapp/user-event/user-event.rb', line 7

def content_type
  @content_type
end

#headersObject

Returns the value of attribute headers.



7
8
9
# File 'lib/gupshup_whatsapp/rest/whatsapp/user-event/user-event.rb', line 7

def headers
  @headers
end

#versionObject

Returns the value of attribute version.



7
8
9
# File 'lib/gupshup_whatsapp/rest/whatsapp/user-event/user-event.rb', line 7

def version
  @version
end

Instance Method Details

#sendObject



14
15
16
17
18
19
# File 'lib/gupshup_whatsapp/rest/whatsapp/user-event/user-event.rb', line 14

def send
  r = Gupshup::HTTP::Client.new
  r = r.request(host = base_uri, port = 443, method = 'GET', url = "/sm/api/v1/users/#{app}", headers = @headers)
  puts r.inspect
  r
end