ufc_schedule 0.1.5 → 1.2.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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/api.rb +10 -2
- data/lib/command_line_interface.rb +7 -0
- data/lib/ufc_schedule/custom_errors.rb +9 -0
- data/lib/ufc_schedule/version.rb +1 -1
- data/ufc_schedule-0.1.5.gem +0 -0
- metadata +4 -3
- data/ufc_schedule-0.1.4.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 498c9cc2a8ce53a8e40c7d1c07e84e104f68844d193fc7faf173ad13a2b9c15a
|
4
|
+
data.tar.gz: 81491aac85b9c8a90d492a404fb92e291beccd987b91913abddf77359a3dd489
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5a1815bfe295e1ff2d9db9178781b2f83a801ee7e268233a6d5c2f7851afc6f191be6a4af822385474e7a767f20787ca48795c1797f797191d09417598c9835
|
7
|
+
data.tar.gz: d29d566337825da3b005ddd63c5a2117edb7f839e0d88f066323342b7935dbfb8a03ed66c37530737b321c8e20e84713cbb6a1182f206f38e88474b9cbc75c75
|
data/Gemfile.lock
CHANGED
data/lib/api.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
+
require 'pry'
|
2
|
+
|
1
3
|
class Concerns::API
|
2
4
|
def self.get_categories
|
3
5
|
cats = RestClient.get('http://ufc-data-api.ufc.com/api/v1/us/events')
|
4
6
|
@data = JSON.parse(cats)
|
5
|
-
|
6
7
|
@data.each do |events|
|
7
8
|
Concerns::Events.new_from_api(events)
|
8
9
|
end
|
@@ -13,7 +14,7 @@ class Concerns::API
|
|
13
14
|
self.reset_data
|
14
15
|
array_of_events.each do |event|
|
15
16
|
event.clear_fights #resets events.event_fights array
|
16
|
-
|
17
|
+
begin #creates error if api is down
|
17
18
|
doc = Nokogiri::HTML(open("http://ufc-data-api.ufc.com/api/v1/us/events/#{event.id}"))
|
18
19
|
|
19
20
|
doc.css('.flipcard-front-pre').each do |card|
|
@@ -36,10 +37,17 @@ class Concerns::API
|
|
36
37
|
#adds the fight to the Events.event_fights array
|
37
38
|
event.event_fights << new_fight
|
38
39
|
end
|
40
|
+
rescue OpenURI::HTTPError => e_message
|
41
|
+
puts e_message
|
42
|
+
puts "UFC API is down"
|
43
|
+
return
|
44
|
+
end
|
39
45
|
end
|
40
46
|
end
|
41
47
|
|
48
|
+
|
42
49
|
def self.reset_data #resets event_fight.all for back funtionality
|
43
50
|
Concerns::EventFight.clear
|
44
51
|
end
|
52
|
+
|
45
53
|
end
|
@@ -43,6 +43,13 @@ extend Concerns::SharedCLIMethods
|
|
43
43
|
def choose_fight_card
|
44
44
|
#Scrapes all the fights from all of the events listed on the schedule and creates fight objects related to each event. Allows user to choose an event, if valid, it will list fights for that event
|
45
45
|
Concerns::API.scrape_fights(Concerns::Events.all)
|
46
|
+
|
47
|
+
#Verify fights have been created
|
48
|
+
if Concerns::EventFight.all.size == 0
|
49
|
+
goodbye
|
50
|
+
exit
|
51
|
+
end
|
52
|
+
|
46
53
|
input = gets.strip
|
47
54
|
|
48
55
|
if input.to_i.between?(1, Concerns::Events.all.size)
|
data/lib/ufc_schedule/version.rb
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ufc_schedule
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joe Quattrone
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-01-
|
11
|
+
date: 2019-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -136,8 +136,9 @@ files:
|
|
136
136
|
- lib/events.rb
|
137
137
|
- lib/shared_methods/shared_cli_methods.rb
|
138
138
|
- lib/ufc_schedule.rb
|
139
|
+
- lib/ufc_schedule/custom_errors.rb
|
139
140
|
- lib/ufc_schedule/version.rb
|
140
|
-
- ufc_schedule-0.1.
|
141
|
+
- ufc_schedule-0.1.5.gem
|
141
142
|
- ufc_schedule.gemspec
|
142
143
|
homepage: https://github.com/JoeQuattrone/ufc_schedule
|
143
144
|
licenses:
|
data/ufc_schedule-0.1.4.gem
DELETED
Binary file
|