linodians 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b5d428ba44f8823bbfe93ed036945951bc256428
4
- data.tar.gz: 6798e731b05f6c64fe99c0762a058feb489747f7
3
+ metadata.gz: aaff050739c2ee67606d1cc9add7a273d730a8f1
4
+ data.tar.gz: 9f9273475a96a2cba589256e6167766b227d5839
5
5
  SHA512:
6
- metadata.gz: ad6cfbb93508d4479c21bef7ad069a7d3212f7baf984d88bdf66327f2105a516483c031565dba82bec977f8def77faf1763c3698cd9a8d77dacd1c2e8742f8dc
7
- data.tar.gz: dd00e3df500227fb6ecd3987bef2509b4a079b42eba9a42eaf9f53572b33a0dec773368e2c89ee1a945d7bf66b0c842f035cb969181a507e6e702b1d18daa232
6
+ metadata.gz: 48b2ef85ffff5001a23007da2720064ec10d7ea3d0fa312f2b3c25753dd25140746cb367a357e89cbd778f82f985982bfe1fafb56c8b889a30334e0bc8709f47
7
+ data.tar.gz: fe225e3b5131e0018dea127579d2d3eb14105a8827ffba3f3fc4be29be9ffeca0f68cb7524b61e46c97975408a4a27f620b2215963fa0adbf5ff4195300574da
data/.travis.yml CHANGED
@@ -8,4 +8,6 @@ notifications:
8
8
  email: false
9
9
  irc:
10
10
  template:
11
- - '%{repository}/%{branch}/%{build_number}: %{message} -- %{build_url}'
11
+ - '%{repository}/%{branch}/%{build_number}: %{message} -- %{build_url}'
12
+ channels:
13
+ - irc.oftc.net#akerl
data/README.md CHANGED
@@ -12,6 +12,49 @@ Library for viewing public Linode employee data
12
12
 
13
13
  ## Usage
14
14
 
15
+ First, create a Linodian object
16
+
17
+ ```
18
+ require 'linodians'
19
+ employees = Linodians.new
20
+ ```
21
+
22
+ You now have an array of all publically listed Linodians. The following attributes are provided:
23
+
24
+ * fullname: Full name as publicized
25
+ * username: Short name as publicized
26
+ * title: Their position
27
+
28
+ Any social sites are also parsed, if provided, including 'twitter', 'linkedin', and 'github'.
29
+
30
+ A `.photo` method is also provided that pulls their public photo.
31
+
32
+ For example, if you want to follow all the Linodians on Twitter, you can quickly grab all available Twitter profiles:
33
+
34
+ ```
35
+ require 'linodians'
36
+ employees = Linodians.new
37
+ twitter_profiles = employees.map { |x| x[:twitter] }.compact
38
+ puts twitter_profiles
39
+ ```
40
+ Say you want to follow any of them you don't already follow? You can combine the above with [sferik's awesome "t" CLI for Twitter](https://github.com/sferik/t):
41
+
42
+ ```
43
+ linodian_accounts = twitter_profiles.map { |x| x.split('/').last }
44
+ currently_following = `t followings`.split
45
+ new_accounts = linodian_accounts.reject { |x| currently_following.include? x }
46
+ new_accounts.each { |x| system "t follow #{x}" }
47
+ ```
48
+
49
+ Or you can find all the listed titles and how many people have each title:
50
+
51
+ ```
52
+ require 'linodians'
53
+ employees = Linodians.new
54
+ titles = employees.map(&:title).each_with_object(Hash.new(0)) { |i, o| o[i] += 1 }
55
+ titles.sort_by(&:last).each { |title, count| puts "#{count} -- #{title}" }
56
+ ```
57
+
15
58
  ## Installation
16
59
 
17
60
  gem install linodians
data/lib/linodians.rb CHANGED
@@ -5,6 +5,7 @@ require 'nokogiri'
5
5
  # Module for parsing Linode employee info
6
6
  module Linodians
7
7
  DATA_URL = 'https://www.linode.com/employees'
8
+ PHOTO_URL = 'https://www.linode.com/media/images/employees/%s.png'
8
9
 
9
10
  class << self
10
11
  ##
@@ -1,3 +1,5 @@
1
+ require 'open-uri'
2
+
1
3
  module Linodians
2
4
  ##
3
5
  # Employee object
@@ -6,14 +8,24 @@ module Linodians
6
8
  @raw = params
7
9
  end
8
10
 
11
+ def photo
12
+ @photo ||= open(PHOTO_URL % username) { |x| x.read }
13
+ end
14
+
9
15
  def [](value)
10
16
  @raw[value.to_sym] || @raw[value.to_s]
11
17
  end
12
18
 
13
- def respond_to?(method, _)
19
+ def to_json(*args, &block)
20
+ @raw.to_json(*args, &block)
21
+ end
22
+
23
+ def respond_to?(method, _ = false)
14
24
  @raw.key?(method) || super
15
25
  end
16
26
 
27
+ private
28
+
17
29
  def method_missing(method, *args, &block)
18
30
  return super unless @raw.key?(method)
19
31
  instance_eval "def #{method}() @raw[:'#{method}'] end"
data/linodians.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'linodians'
3
- s.version = '0.0.1'
3
+ s.version = '0.0.2'
4
4
  s.date = Time.now.strftime("%Y-%m-%d")
5
5
 
6
6
  s.summary = 'Parse Linode employees'
@@ -13,8 +13,10 @@ Gem::Specification.new do |s|
13
13
  s.files = `git ls-files`.split
14
14
  s.test_files = `git ls-files spec/*`.split
15
15
 
16
- s.add_development_dependency 'rubocop', '~> 0.26.0'
17
- s.add_development_dependency 'rake', '~> 10.3.2'
16
+ s.add_dependency 'nokogiri', '~> 1.6.5'
17
+
18
+ s.add_development_dependency 'rubocop', '~> 0.28.0'
19
+ s.add_development_dependency 'rake', '~> 10.4.0'
18
20
  s.add_development_dependency 'coveralls', '~> 0.7.1'
19
21
  s.add_development_dependency 'rspec', '~> 3.1.0'
20
22
  s.add_development_dependency 'fuubar', '~> 2.0.0'
metadata CHANGED
@@ -1,43 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: linodians
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Les Aker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-11 00:00:00.000000000 Z
11
+ date: 2015-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: nokogiri
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 1.6.5
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 1.6.5
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: rubocop
15
29
  requirement: !ruby/object:Gem::Requirement
16
30
  requirements:
17
31
  - - "~>"
18
32
  - !ruby/object:Gem::Version
19
- version: 0.26.0
33
+ version: 0.28.0
20
34
  type: :development
21
35
  prerelease: false
22
36
  version_requirements: !ruby/object:Gem::Requirement
23
37
  requirements:
24
38
  - - "~>"
25
39
  - !ruby/object:Gem::Version
26
- version: 0.26.0
40
+ version: 0.28.0
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: rake
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
45
  - - "~>"
32
46
  - !ruby/object:Gem::Version
33
- version: 10.3.2
47
+ version: 10.4.0
34
48
  type: :development
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
52
  - - "~>"
39
53
  - !ruby/object:Gem::Version
40
- version: 10.3.2
54
+ version: 10.4.0
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: coveralls
43
57
  requirement: !ruby/object:Gem::Requirement