Class: Hibp::Models::Paste

Inherits:
Object
  • Object
show all
Includes:
Helpers::AttributeAssignment
Defined in:
lib/hibp/models/paste.rb

Overview

Hibp::Models::Paste

Used to construct a "paste" model

A "paste" is information that has been "pasted" to a publicly facing
website designed to share content such as Pastebin.

These services are favoured by hackers due to the ease of anonymously
sharing information and they're frequently the first place a breach appears.

@note In the future, these attributes may expand without the API being versioned.

@see https://haveibeenpwned.com/FAQs

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ Paste

Returns a new instance of Paste.

Parameters:

  • attributes (Hash)

Options Hash (attributes):

  • :source (String)

    - The paste service the record was retrieved from. Current values are:

    - Pastebin
    - Pastie
    - Slexy
    - Ghostbin
    - QuickLeak
    - JustPaste
    - AdHocUrl
    - PermanentOptOut
    - OptOut
    
  • :id (String)

    - The ID of the paste as it was given at the source service. Combined with the “Source” attribute, this can be used to resolve the URL of the paste.

  • :title (String)

    - The title of the paste as observed on the source site. This may be null.

  • :date (String)

    - The date and time (precision to the second) that the paste was posted. This is taken directly from the paste site when this information is available but may be null if no date is published.

  • :email_count (Integer)

    - The number of emails that were found when processing the paste. Emails are extracted by using the regular expression: b+(?!^.256)[a-zA-Z0-9.-_+]+@\.[a-zA-Z]b



57
58
59
# File 'lib/hibp/models/paste.rb', line 57

def initialize(attributes)
  assign_attributes(attributes)
end

Instance Attribute Details

#dateObject

Returns the value of attribute date.



22
23
24
# File 'lib/hibp/models/paste.rb', line 22

def date
  @date
end

#email_countObject

Returns the value of attribute email_count.



22
23
24
# File 'lib/hibp/models/paste.rb', line 22

def email_count
  @email_count
end

#idObject

Returns the value of attribute id.



22
23
24
# File 'lib/hibp/models/paste.rb', line 22

def id
  @id
end

#sourceObject

Returns the value of attribute source.



22
23
24
# File 'lib/hibp/models/paste.rb', line 22

def source
  @source
end

#titleObject

Returns the value of attribute title.



22
23
24
# File 'lib/hibp/models/paste.rb', line 22

def title
  @title
end