Class: Mock::Bandwidth::WebhookClient

Inherits:
Object
  • Object
show all
Defined in:
lib/mock/bandwidth/webhook_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url:, params: nil, headers: {}) ⇒ WebhookClient

Returns a new instance of WebhookClient.



8
9
10
11
12
# File 'lib/mock/bandwidth/webhook_client.rb', line 8

def initialize(url:, params: nil, headers: {})
  @url = url
  @params = params
  @headers = headers
end

Instance Attribute Details

#headersObject (readonly)

Returns the value of attribute headers.



6
7
8
# File 'lib/mock/bandwidth/webhook_client.rb', line 6

def headers
  @headers
end

#paramsObject (readonly)

Returns the value of attribute params.



6
7
8
# File 'lib/mock/bandwidth/webhook_client.rb', line 6

def params
  @params
end

#urlObject (readonly)

Returns the value of attribute url.



6
7
8
# File 'lib/mock/bandwidth/webhook_client.rb', line 6

def url
  @url
end

Instance Method Details

#postObject



14
15
16
17
18
# File 'lib/mock/bandwidth/webhook_client.rb', line 14

def post
  arguments = { body: params, headers: headers }

  ::HTTParty.post(url, **arguments)
end