summaryrefslogtreecommitdiff
path: root/pharo-mooc/contact-book/src/ContactBook/Contact.class.st
blob: 67ca67430ff7234c5b938d8a1f2d41a5bc5061f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
"
I represent a person with a name and an email address. I'm usually
part of a contact book.
"
Class {
	#name : 'Contact',
	#superclass : 'Object',
	#instVars : [
		'fullname',
		'email'
	],
	#category : 'ContactBook',
	#package : 'ContactBook'
}

{ #category : 'instance creation' }
Contact class >> newNamed: aNameString email: anEmailString [
	^ self new
		fullname: aNameString;
		email: anEmailString;
		yourself
]

{ #category : 'accessing' }
Contact >> email [

	^ email
]

{ #category : 'accessing' }
Contact >> email: anObject [

	email := anObject
]

{ #category : 'accessing' }
Contact >> fullname [

	^ fullname
]

{ #category : 'accessing' }
Contact >> fullname: aString [

	fullname := aString
]

{ #category : 'as yet unclassified' }
Contact >> gravatarUrl [
	^ 'http://www.gravatar.com/avatar/',
	 (MD5 hashMessage: email asString trimBoth asLowercase) hex,
	 '.jpg'
]

{ #category : 'accessing' }
Contact >> printOn: aStream [
	aStream
		nextPutAll: self fullname;
		nextPutAll: ' <';
		nextPutAll: self email;
		nextPutAll: '>'
]