Class: HookSniff::Models::Endpoint

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Endpoint

Returns a new instance of Endpoint.



8
9
10
11
12
13
14
15
# File 'lib/hooksniff/models.rb', line 8

def initialize(data)
  @id = data["id"]
  @url = data["url"]
  @description = data["description"]
  @is_active = data["is_active"]
  @retry_policy = data["retry_policy"] ? RetryPolicy.new(data["retry_policy"]) : nil
  @created_at = data["created_at"]
end

Instance Attribute Details

#created_atObject (readonly)

Returns the value of attribute created_at.



6
7
8
# File 'lib/hooksniff/models.rb', line 6

def created_at
  @created_at
end

#descriptionObject (readonly)

Returns the value of attribute description.



6
7
8
# File 'lib/hooksniff/models.rb', line 6

def description
  @description
end

#idObject (readonly)

Returns the value of attribute id.



6
7
8
# File 'lib/hooksniff/models.rb', line 6

def id
  @id
end

#is_activeObject (readonly)

Returns the value of attribute is_active.



6
7
8
# File 'lib/hooksniff/models.rb', line 6

def is_active
  @is_active
end

#retry_policyObject (readonly)

Returns the value of attribute retry_policy.



6
7
8
# File 'lib/hooksniff/models.rb', line 6

def retry_policy
  @retry_policy
end

#urlObject (readonly)

Returns the value of attribute url.



6
7
8
# File 'lib/hooksniff/models.rb', line 6

def url
  @url
end

Instance Method Details

#to_hObject



17
18
19
20
21
22
23
24
25
26
# File 'lib/hooksniff/models.rb', line 17

def to_h
  {
    id: @id,
    url: @url,
    description: @description,
    is_active: @is_active,
    retry_policy: @retry_policy&.to_h,
    created_at: @created_at
  }
end