Class: Hawker::Drivers::Github

Inherits:
Default
  • Object
show all
Defined in:
lib/hawker/drivers/github.rb

Instance Method Summary collapse

Methods inherited from Default

#initialize, #page_title

Constructor Details

This class inherits a constructor from Hawker::Drivers::Default

Instance Method Details

#companyString

The current user company

Returns:

  • (String)


22
23
24
# File 'lib/hawker/drivers/github.rb', line 22

def company
  node_text html.at("li[itemprop='worksFor'] div")
end

#followersInteger

The count of users following the current user

Returns:

  • (Integer)


58
59
60
# File 'lib/hawker/drivers/github.rb', line 58

def followers
  node_text(html.at("a[title='Followers'] span.Counter")).to_i
end

#followingInteger

The count of users that the current user is following

Returns:

  • (Integer)


65
66
67
# File 'lib/hawker/drivers/github.rb', line 65

def following
  node_text(html.at("a[title='Following'] span.Counter")).to_i
end

#locationString

The current user location

Returns:

  • (String)


29
30
31
# File 'lib/hawker/drivers/github.rb', line 29

def location
  node_text html.at("li[itemprop='homeLocation'] span")
end

#nameString

The current user full name

Returns:

  • (String)


8
9
10
# File 'lib/hawker/drivers/github.rb', line 8

def name
  node_text html.at("h1.vcard-names span.vcard-fullname[itemprop='name']")
end

#repositoriesInteger

The count of repositiories owned by the current user

Returns:

  • (Integer)


44
45
46
# File 'lib/hawker/drivers/github.rb', line 44

def repositories
  node_text(html.at("a[title='Repositories'] span.Counter")).to_i
end

#starsInteger

The count of stars that the current user gave

Returns:

  • (Integer)


51
52
53
# File 'lib/hawker/drivers/github.rb', line 51

def stars
  node_text(html.at("a[title='Stars'] span.Counter")).to_i
end

#usernameString

The current user nickname

Returns:

  • (String)


15
16
17
# File 'lib/hawker/drivers/github.rb', line 15

def username
  node_text html.at("h1.vcard-names span.vcard-username[itemprop='additionalName']")
end

#websiteString

The current user website

Returns:

  • (String)


36
37
38
39
# File 'lib/hawker/drivers/github.rb', line 36

def website
  node = html.at("li[itemprop='url'] a")
  node[:href] unless node.nil?
end