Class: PrintNode::Account

Inherits:
Object
  • Object
show all
Defined in:
lib/printnode/account.rb

Overview

An object to deal with Account Creation.

Author:

  • Jake Torrance

  • PrintNode

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(firstname, lastname, email, password) ⇒ Account

Initialize our object ready for being mapped into a hash.



24
25
26
27
28
29
# File 'lib/printnode/account.rb', line 24

def initialize(firstname, lastname, email, password)
  @firstname = firstname
  @lastname = lastname
  @email = email
  @password = password
end

Instance Attribute Details

#creator_refObject

Returns the value of attribute creator_ref.



10
11
12
# File 'lib/printnode/account.rb', line 10

def creator_ref
  @creator_ref
end

#emailObject

Returns the value of attribute email.



8
9
10
# File 'lib/printnode/account.rb', line 8

def email
  @email
end

#firstnameObject

Returns the value of attribute firstname.



6
7
8
# File 'lib/printnode/account.rb', line 6

def firstname
  @firstname
end

#lastnameObject

Returns the value of attribute lastname.



7
8
9
# File 'lib/printnode/account.rb', line 7

def lastname
  @lastname
end

#passwordObject

Returns the value of attribute password.



9
10
11
# File 'lib/printnode/account.rb', line 9

def password
  @password
end

Instance Method Details

#to_hashObject

Map our object into a hash for JSON Encoding.



13
14
15
16
17
18
19
20
21
# File 'lib/printnode/account.rb', line 13

def to_hash
  hash = {}
  hash['firstname'] = @firstname
  hash['lastname'] = @lastname
  hash['email'] = @email
  hash['password'] = @password
  hash['creatorRef'] = @creator_ref if @creator_ref
  hash
end