Class: Lotus::Author

Inherits:
Object
  • Object
show all
Defined in:
lib/lotus/author.rb

Overview

Holds information about the author of the Feed.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Author

Creates a representating of an author.

options:

name               => The name of the author. Defaults: "anonymous"
id                 => The identifier that uniquely identifies the
                      contact.
nickname           => The nickname of the contact.
gender             => The gender of the contact.
note               => A note for this contact.
display_name       => The display name for this contact.
preferred_username => The preferred username for this contact.
updated            => A DateTime representing when this contact was
                      last updated.
published          => A DateTime representing when this contact was
                      originally created.
birthday           => A DateTime representing a birthday for this
                      contact.
anniversary        => A DateTime representing an anniversary for this
                      contact.
extended_name      => A Hash representing the name of the contact.
organization       => A Hash representing the organization of which the
                      contact belongs.
account            => A Hash describing the authorative account for the
                      author.
address            => A Hash describing the address of the contact.
uri                => The uri that uniquely identifies this author.
email              => The email of the author.


130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# File 'lib/lotus/author.rb', line 130

def initialize(options = {})
  @uri = options[:uri]
  @name = options[:name] || "anonymous"
  @email = options[:email]

  @id = options[:id]
  @name = options[:name]
  @gender = options[:gender]
  @note = options[:note]
  @nickname = options[:nickname]
  @display_name = options[:display_name]
  @preferred_username = options[:preferred_username]
  @updated = options[:updated]
  @published = options[:published]
  @birthday = options[:birthday]
  @anniversary = options[:anniversary]

  @extended_name = options[:extended_name]
  @organization = options[:organization]
  @account = options[:account]
  @address = options[:address]
end

Instance Attribute Details

#accountObject (readonly)

Holds a hash representing information about an account held by this contact.

contains one or more of the following:

:domain   => The top-most authoriative domain for this account. (e.g.
             "twitter.com") This is the primary field. Is required.
             Used for sorting.
:username => An alphanumeric username, typically chosen by the user.
:userid   => A user id, typically assigned, that uniquely refers to
             the user.


76
77
78
# File 'lib/lotus/author.rb', line 76

def 
  @account
end

#addressObject (readonly)

Holds a hash representing the address of the contact.

contains one or more of the following:

:formatted      => A formatted representating of the address. May
                  contain newlines.
:street_address => The full street address. May contain newlines.
:locality       => The city or locality component.
:region         => The state or region component.
:postal_code    => The zipcode or postal code component.
:country        => The country name component.


46
47
48
# File 'lib/lotus/author.rb', line 46

def address
  @address
end

#anniversaryObject (readonly)

Holds a DateTime representing a contact’s anniversary.



101
102
103
# File 'lib/lotus/author.rb', line 101

def anniversary
  @anniversary
end

#birthdayObject (readonly)

Holds a DateTime representing this contact’s birthday.



98
99
100
# File 'lib/lotus/author.rb', line 98

def birthday
  @birthday
end

#display_nameObject (readonly)

Holds the display name for this contact.



85
86
87
# File 'lib/lotus/author.rb', line 85

def display_name
  @display_name
end

#emailObject (readonly)

The email address of the author.



31
32
33
# File 'lib/lotus/author.rb', line 31

def email
  @email
end

#extended_nameObject (readonly)

Holds a hash representing information about the name of this contact.

contains one or more of the following:

:formatted         => The full name of the contact
:family_name       => The family name. "Last name" in Western contexts.
:given_name        => The given name. "First name" in Western contexts.
:middle_name       => The middle name.
:honorific_prefix  => "Title" in Western contexts. (e.g. "Mr." "Mrs.")
:honorific_suffix  => "Suffix" in Western contexts. (e.g. "Esq.")


25
26
27
# File 'lib/lotus/author.rb', line 25

def extended_name
  @extended_name
end

#genderObject (readonly)

Holds the gender of this contact.



79
80
81
# File 'lib/lotus/author.rb', line 79

def gender
  @gender
end

#idObject (readonly)

Holds the id that represents this contact.



11
12
13
# File 'lib/lotus/author.rb', line 11

def id
  @id
end

#nameObject (readonly)

The name of the author



34
35
36
# File 'lib/lotus/author.rb', line 34

def name
  @name
end

#nicknameObject (readonly)

Holds the nickname of this contact.



14
15
16
# File 'lib/lotus/author.rb', line 14

def nickname
  @nickname
end

#noteObject (readonly)

Holds a note for this contact.



82
83
84
# File 'lib/lotus/author.rb', line 82

def note
  @note
end

#organizationObject (readonly)

Holds a hash representing an organization for this contact.

contains one or more of the following:

:name        => The name of the organization (e.g. company, school,
                etc) This field is required. Will be used for sorting.
:department  => The department within the organization.
:title       => The title or role within the organization.
:type        => The type of organization. Canonical values include
                "job" or "school"
:start_date  => A DateTime representing when the contact joined
                the organization.
:end_date    => A DateTime representing when the contact left the
                organization.
:location    => The physical location of this organization.
:description => A free-text description of the role this contact
                played in this organization.


64
65
66
# File 'lib/lotus/author.rb', line 64

def organization
  @organization
end

#preferred_usernameObject (readonly)

Holds the preferred username of this contact.



88
89
90
# File 'lib/lotus/author.rb', line 88

def preferred_username
  @preferred_username
end

#publishedObject (readonly)

Holds a DateTime that represents when this contact was originally published.



95
96
97
# File 'lib/lotus/author.rb', line 95

def published
  @published
end

#updatedObject (readonly)

Holds a DateTime that represents when this contact was last modified.



91
92
93
# File 'lib/lotus/author.rb', line 91

def updated
  @updated
end

#uriObject (readonly)

The uri that uniquely identifies the author.



28
29
30
# File 'lib/lotus/author.rb', line 28

def uri
  @uri
end

Instance Method Details

#to_hashObject



153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# File 'lib/lotus/author.rb', line 153

def to_hash
  {
    :uri => self.uri,
    :email => self.email,
    :name => self.name,

    :id => self.id,
    :gender => self.gender,
    :note => self.note,
    :nickname => self.nickname,
    :display_name => self.display_name,
    :preferred_username => self.preferred_username,
    :updated => self.updated,
    :published => self.published,
    :birthday => self.birthday,
    :anniversary => self.anniversary,

    :extended_name => self.extended_name,
    :organization => self.organization,
    :account => self.,
    :address => self.address
  }
end