fifa_rankings 1.0.0 → 1.1.0

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: 03ef443eef1ccc241da0dd37e526d03179148786
4
- data.tar.gz: af831f9a21f45a12574fc98b55c09bdc630b8a9f
3
+ metadata.gz: e994b67d15c5d5300ad459167496083dc3d7f901
4
+ data.tar.gz: fcaaeb8d6e318d640418d8ff9b68f52a299ea806
5
5
  SHA512:
6
- metadata.gz: 4708e55ecdf7e9d8de4dbf1543b5c4de9b094d5a59db1331e6885a5e435f8601eab0801dc835dbf9092dccb3ebfb665a99f4d8699473c3de3330d0e1ea07e048
7
- data.tar.gz: 7810026eec1e5f9ab8e1f02bfaf83b813cd433490c02710a5f54e0bf0af481a1ba1b7f3e840c4be4ceef0b440432bc9f3d72df3fc5bb26c0afcfbde6e4ec5a4e
6
+ metadata.gz: 24bf6694dadb51888d701c84f57d171599c06c0f43244c5319ea051de1faeb5dc6428739bb49c344ec05a20d70e4b4d6163cc508b0cc769aa602e6706b48e1d1
7
+ data.tar.gz: a59ad5fd5b5f15cd11200d58c04b8e56fc46a449ad540863c2d84fdab382dbd217b9fa32cd14bca49dc6c8a6df04d33860ef1480d8dc5b4dcbfd60640837d6bc
Binary file
@@ -2,7 +2,7 @@ class FifaRankings::CLI
2
2
 
3
3
  def call
4
4
  welcome
5
- load_data
5
+ get_teams
6
6
  list
7
7
  details
8
8
  goodbye
@@ -19,24 +19,12 @@ class FifaRankings::CLI
19
19
  puts "Goodbye! Come back to see the updated rankings soon."
20
20
  end
21
21
 
22
- def load_data
23
- get_teams
24
- add_attributes
25
- end
26
22
 
27
23
  def get_teams
28
24
  teams = FifaRankings::Scraper.scrape_rankings_page('https://en.wikipedia.org/wiki/FIFA_Women%27s_World_Rankings')
29
25
  FifaRankings::Team.create_from_array(teams)
30
26
  end
31
27
 
32
- def add_attributes
33
- FifaRankings::Team.all.each do |team|
34
- # sleep 1.0 + rand
35
- attributes = FifaRankings::Scraper.scrape_team_page('https://en.wikipedia.org' + team.url)
36
- team.add_attributes(attributes)
37
- end
38
- end
39
-
40
28
  def list
41
29
  format = '%-6s %-14s %-10s'
42
30
 
@@ -50,7 +38,6 @@ class FifaRankings::CLI
50
38
  end
51
39
  end
52
40
 
53
-
54
41
  def details
55
42
  input = nil
56
43
  while input != "exit"
@@ -73,6 +60,8 @@ class FifaRankings::CLI
73
60
 
74
61
  def print_team(input)
75
62
  team = FifaRankings::Team.find_by_rank(input.to_i) || FifaRankings::Team.find_by_name(input)
63
+ attributes = FifaRankings::Scraper.scrape_team_page('https://en.wikipedia.org' + team.url)
64
+ team.add_attributes(attributes)
76
65
 
77
66
  puts ""
78
67
  puts " #{team.name.upcase}"
@@ -3,6 +3,7 @@ class FifaRankings::Team
3
3
 
4
4
  @@all = []
5
5
 
6
+
6
7
  def initialize(team_hash)
7
8
  team_hash.each do |k,v|
8
9
  self.send(("#{k}="),v)
@@ -10,6 +11,10 @@ class FifaRankings::Team
10
11
  @@all << self
11
12
  end
12
13
 
14
+ def self.points_greater_than(number)
15
+ self.all.select {|team| team.points > number}
16
+ end
17
+
13
18
  def self.create_from_array(array)
14
19
  # create Team instances from an array of hashes
15
20
  array.each {|team| self.new(team)}
@@ -1,3 +1,3 @@
1
1
  module FifaRankings
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fifa_rankings
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sydney Chun
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-11 00:00:00.000000000 Z
11
+ date: 2017-08-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -96,6 +96,7 @@ files:
96
96
  - bin/fifa-rankings
97
97
  - bin/setup
98
98
  - fifa_rankings-0.1.0.gem
99
+ - fifa_rankings-1.0.0.gem
99
100
  - fifa_rankings.gemspec
100
101
  - lib/fifa_rankings.rb
101
102
  - lib/fifa_rankings/cli.rb