Class: Refinery::WordPress::Author

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(author_node) ⇒ Author

Returns a new instance of Author.



6
7
8
# File 'lib/wordpress/author.rb', line 6

def initialize(author_node)
  @author_node = author_node
end

Instance Attribute Details

#author_nodeObject (readonly)

Returns the value of attribute author_node.



4
5
6
# File 'lib/wordpress/author.rb', line 4

def author_node
  @author_node
end

Instance Method Details

#==(other) ⇒ Object



18
19
20
# File 'lib/wordpress/author.rb', line 18

def ==(other)
   == other.
end

#emailObject



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

def email
  author_node.xpath("wp:author_email").text
end

#inspectObject



22
23
24
# File 'lib/wordpress/author.rb', line 22

def inspect
  "WordPress::Author: #{} <#{email}>"
end

#loginObject



10
11
12
# File 'lib/wordpress/author.rb', line 10

def 
  author_node.xpath("wp:author_login").text
end

#to_refineryObject



26
27
28
29
30
31
32
33
34
# File 'lib/wordpress/author.rb', line 26

def to_refinery
  user = User.find_or_initialize_by_username_and_email(, email)
  unless user.persisted?
    user.password = 'password'
    user.password_confirmation = 'password'
    user.save
  end
  user
end