Class: Hookd::Hook
- Inherits:
-
Object
- Object
- Hookd::Hook
- Defined in:
- lib/hookd/hook.rb
Overview
Represents a registered hook with DNS and HTTP endpoints
Instance Attribute Summary collapse
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#dns ⇒ Object
readonly
Returns the value of attribute dns.
-
#http ⇒ Object
readonly
Returns the value of attribute http.
-
#https ⇒ Object
readonly
Returns the value of attribute https.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Create a Hook from API response hash.
Instance Method Summary collapse
-
#initialize(id:, dns:, http:, https:, created_at:) ⇒ Hook
constructor
A new instance of Hook.
- #to_s ⇒ Object
Constructor Details
#initialize(id:, dns:, http:, https:, created_at:) ⇒ Hook
Returns a new instance of Hook.
8 9 10 11 12 13 14 |
# File 'lib/hookd/hook.rb', line 8 def initialize(id:, dns:, http:, https:, created_at:) @id = id @dns = dns @http = http @https = https @created_at = created_at end |
Instance Attribute Details
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
6 7 8 |
# File 'lib/hookd/hook.rb', line 6 def created_at @created_at end |
#dns ⇒ Object (readonly)
Returns the value of attribute dns.
6 7 8 |
# File 'lib/hookd/hook.rb', line 6 def dns @dns end |
#http ⇒ Object (readonly)
Returns the value of attribute http.
6 7 8 |
# File 'lib/hookd/hook.rb', line 6 def http @http end |
#https ⇒ Object (readonly)
Returns the value of attribute https.
6 7 8 |
# File 'lib/hookd/hook.rb', line 6 def https @https end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'lib/hookd/hook.rb', line 6 def id @id end |
Class Method Details
.from_hash(hash) ⇒ Object
Create a Hook from API response hash
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/hookd/hook.rb', line 17 def self.from_hash(hash) raise ArgumentError, "Invalid hash: expected Hash, got #{hash.class}" unless hash.is_a?(Hash) new( id: hash['id'], dns: hash['dns'], http: hash['http'], https: hash['https'], created_at: hash['created_at'] ) end |
Instance Method Details
#to_s ⇒ Object
29 30 31 |
# File 'lib/hookd/hook.rb', line 29 def to_s "#<Hookd::Hook id=#{id} dns=#{dns}>" end |