RDC 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/RDC/catalog.rb +0 -8
- data/lib/RDC/restaurant.rb +2 -2
- data/lib/RDC/restaurant_info.rb +2 -2
- data/lib/RDC/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 296ad5ee8fdf75da3cc8dab3640dcccbe04f16a7fa5c465253666db9ddabd43d
|
4
|
+
data.tar.gz: 3218e90fca0a4d9db1523f173fe798216ac4c8de5bad9ee573e1c6fde2d93ce2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6f7af05ca5a4d6f19688470da2d4c86f8ab6923f37ff2aa471c68d5b4362cace877a9c78080141921b868bec990a45eba8b151263cc0782342b6f79775ac6cd
|
7
|
+
data.tar.gz: '028971bffed27b3689fd5eb1e64f986a4dc40cb5391d7c6d10067d1e8eb1643863a21e813132e3a82ed028605f0dcb13312dfa061523d8e6593a571e33506250'
|
data/lib/RDC/catalog.rb
CHANGED
@@ -16,35 +16,27 @@ module RDC
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def download_xml_catalog
|
19
|
-
puts '[RDC] Start Downloading ZIP File from FTP Server.'
|
20
19
|
Net::SFTP.start(RDC.ftp_url, RDC.ftp_username, password: RDC.ftp_password) do |sftp|
|
21
20
|
sftp.download!('/rdc_MemberHub.zip', downloads_directory.join('rdc_MemberHub.zip').to_s)
|
22
21
|
end
|
23
|
-
puts '[RDC] Finished Downloading ZIP File from FTP Server.'
|
24
22
|
end
|
25
23
|
|
26
24
|
def extract_zip_file
|
27
|
-
puts '[RDC] Starting Extracting XML File from ZIP File.'
|
28
25
|
Zip::File.open(downloads_directory.join('rdc_MemberHub.zip')) do |zip_file|
|
29
26
|
zip_file.each do |f|
|
30
27
|
fpath = File.join(downloads_directory.to_s, f.name)
|
31
28
|
zip_file.extract(f, fpath) unless File.exist?(fpath)
|
32
29
|
end
|
33
30
|
end
|
34
|
-
puts '[RDC] Done Extracting XML File from ZIP File.'
|
35
31
|
end
|
36
32
|
|
37
33
|
def parse_xml_file
|
38
|
-
puts '[RDC] Parsing XML'
|
39
34
|
xml_file_path = downloads_directory.join('rdc_MemberHub.xml')
|
40
35
|
@xml = Hash.from_xml(File.open(xml_file_path))
|
41
|
-
puts '[RDC] Finished parsing XML'
|
42
36
|
end
|
43
37
|
|
44
38
|
def process_xml_content
|
45
|
-
puts '[RDC] Starting XML Processing'
|
46
39
|
@catalog = @xml["Catalogs"]["catalog"].collect { |catalog_hash| RDC::Restaurant.new(catalog_hash) }
|
47
|
-
puts '[RDC] Finished XML Processing'
|
48
40
|
@catalog
|
49
41
|
end
|
50
42
|
|
data/lib/RDC/restaurant.rb
CHANGED
@@ -5,10 +5,10 @@ require_relative 'item'
|
|
5
5
|
module RDC
|
6
6
|
class Restaurant
|
7
7
|
attr_accessor :name, :items, :short_description, :long_description,
|
8
|
-
:online, :address, :image
|
8
|
+
:online, :address, :image, :id
|
9
9
|
|
10
10
|
def initialize(hash_values)
|
11
|
-
|
11
|
+
@id = hash_values['LegacyRestaurantId']
|
12
12
|
@name = hash_values['RestaurantName']
|
13
13
|
@short_description = hash_values['ShortDescription']
|
14
14
|
@long_description = hash_values['LongDescription']
|
data/lib/RDC/restaurant_info.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative 'request'
|
4
4
|
|
5
5
|
module RDC
|
6
6
|
class RestaurantInfo
|
7
7
|
class << self
|
8
8
|
def retrieve(restaurant_id)
|
9
9
|
request = Request.new("/restaurant_info/#{restaurant_id}")
|
10
|
-
|
10
|
+
response = request.get
|
11
11
|
response.json
|
12
12
|
end
|
13
13
|
end
|
data/lib/RDC/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: RDC
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- davidrichey
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-12-
|
12
|
+
date: 2020-12-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|