Class: Justiz::Contact
- Inherits:
-
Object
- Object
- Justiz::Contact
- Defined in:
- lib/justiz/contact.rb
Constant Summary collapse
- FIELDS =
[:court, :location, :post, :phone, :fax, :justiz_id, :url, :email]
Instance Method Summary collapse
- #attributes=(attributes) ⇒ Object
- #digest ⇒ Object
- #id ⇒ Object
-
#initialize(attributes = {}) ⇒ Contact
constructor
A new instance of Contact.
- #location_address ⇒ Object
- #post_address ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Contact
Returns a new instance of Contact.
9 10 11 |
# File 'lib/justiz/contact.rb', line 9 def initialize(attributes = {}) self.attributes = attributes end |
Instance Method Details
#attributes=(attributes) ⇒ Object
13 14 15 16 17 |
# File 'lib/justiz/contact.rb', line 13 def attributes=(attributes) attributes.each do |key, value| send("#{key}=", value) if respond_to?("#{key}=") end end |
#digest ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/justiz/contact.rb', line 34 def digest sha256 = Digest::SHA2.new FIELDS.each do |field| sha256 << send(field) end Digest.hexencode(sha256.digest) end |
#id ⇒ Object
19 20 21 22 23 24 |
# File 'lib/justiz/contact.rb', line 19 def id # too many duplicates #[court, justiz_id].compact.join("") # currently no duplicates [court, email].compact.join("") end |