Class: Webhook::CLI::Poster

Inherits:
Object
  • Object
show all
Defined in:
lib/webhook/cli/poster.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.post(url_string, json_path) ⇒ Object



4
5
6
# File 'lib/webhook/cli/poster.rb', line 4

def self.post(url_string, json_path)
  new.post(url_string, json_path)
end

Instance Method Details

#post(url_string, json_path) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/webhook/cli/poster.rb', line 7

def post(url_string, json_path)
  verify_url(url_string)
  json = detect_json(json_path)
  conn = Faraday.new url: url_string
  params = {
      payload: json
  }
  conn.post nil, params
end