Class: Pushould::Client

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url) ⇒ Client

Returns a new instance of Client.



9
10
11
# File 'lib/pushould/client.rb', line 9

def initialize(url)
  @url = url
end

Instance Attribute Details

#urlObject (readonly)

Returns the value of attribute url.



7
8
9
# File 'lib/pushould/client.rb', line 7

def url
  @url
end

Instance Method Details

#trigger(room: _room, event: _event, data: _data) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/pushould/client.rb', line 13

def trigger(room: _room, event: _event, data: _data)
  data = { room: room,
           event: event,
           custom: data }.to_json
  RestClient::Resource.new(@url)
                      .get(params: { data: data },
                           content_type: 'application/json',
                           accept: 'application/json')
end