Class: Webhook

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

Instance Method Summary collapse

Constructor Details

#initialize(cwr, path, complete = false) ⇒ Webhook

Returns a new instance of Webhook.



68
69
70
71
72
73
# File 'lib/cwr.rb', line 68

def initialize(cwr, path, complete=false)
  @cwr = cwr
  @path = path
  @hooked = true
  @complete = complete
end

Instance Method Details

#complete?Boolean

Returns:

  • (Boolean)


80
81
82
# File 'lib/cwr.rb', line 80

def complete?
  @complete
end

#destroyObject



84
85
86
# File 'lib/cwr.rb', line 84

def destroy
  @hooked = false
end

#hooked?Boolean

Returns:

  • (Boolean)


75
76
77
78
# File 'lib/cwr.rb', line 75

def hooked?
  raise "wtf unhookedwebhook" unless @hooked
  @hooked
end

#updateObject



88
89
90
91
# File 'lib/cwr.rb', line 88

def update
  resp = @cwr.update_webhook(@path)
  @complete = !resp["attempt"]
end