wdw_sources 0.1.2 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4b83ba735f378c1487719a66aba53c356c905915b7652d966962f95366126b62
4
- data.tar.gz: f7f086037e65d264a2b404876c3110917223054676ca7ab753650d4fb9601961
3
+ metadata.gz: af4dce345954fdfb0f519f8d08adeb8957f212da046d18dc79f1c61a7fa13cbc
4
+ data.tar.gz: 44f993ac032e04b56e94b3c02b86eee1287dbcdede3bee00e427bee95f7d5d89
5
5
  SHA512:
6
- metadata.gz: b2f7407463fc0d56d41c8581f667ec976c3fd09107bafd6f4e35e13e52d98a1dfa26e393dfe61c2b3a77e993854e49224e036661495d60dd881a937a2dc6f6cd
7
- data.tar.gz: 434f8bec1133b93d9153b9acd36fa20bb599013a877b061cfed401f98bf62e6c79d6fc60a662b3dc7381d87e8082d63b96675402ce12a8de37a753891a1d6877
6
+ metadata.gz: 3d0f9b3cb1ebcb9782f0c73567aab72831b8538e59f2d5709803bb99e845c98bbfea3c222b0121e2cd568a4e86b3945e73a2ac2603a0179b3a8f3b568a7125d5
7
+ data.tar.gz: 1e4883a7606721a759274d39c3ebaaaa7d548abf08ea729c95250fe7367b440d84464d61d3b8b5cdad796cc8832178ade44bce9aeae9a76fa9bd785bcd622690
@@ -10,23 +10,33 @@ module WdwSources
10
10
 
11
11
  tp_list = Touringplans.list_all(interest)
12
12
  tp_list.each do |tp_list_item|
13
- _cache_tp_place(tp_list_item, interest)
13
+ tp_list_item_venue_permalink = tp_list_item.venue_permalink
14
+ tp_list_item_permalink = tp_list_item.permalink
15
+
16
+ _cache_tp_place(tp_list_item_venue_permalink, tp_list_item_permalink, interest)
14
17
  end
15
18
  end
16
19
 
17
- def self._cache_tp_place(tp_list_item, interest)
18
- interest = interest.to_sym
20
+ def self._cache_tp_place(tp_list_item_venue_permalink, tp_list_item_permalink, interest)
21
+ return "Missing tp_list_item_venue_permalink" if tp_list_item_venue_permalink.to_s.length < 3
22
+ return "Missing tp_list_item_permalink" if tp_list_item_permalink.to_s.length < 3
23
+ return "Missing interest" if interest.to_s.length < 3
19
24
 
20
- cache_resources = {attractions: WdwSources::TouringplansAttraction,
21
- dining: WdwSources::TouringplansDiningVenue,
22
- hotels: WdwSources::TouringplansHotel
25
+ cache_resources = {"attractions" => WdwSources::TouringplansAttraction,
26
+ "dining" => WdwSources::TouringplansDiningVenue,
27
+ "hotels" => WdwSources::TouringplansHotel
23
28
  }
24
29
 
25
30
  cache_resource = cache_resources[interest]
26
- cache_item = cache_resource.find_or_create_by(permalink: tp_list_item.permalink)
31
+ cache_item = cache_resource.find_or_create_by(permalink: tp_list_item_permalink)
32
+
33
+ tp_item_full_record = Touringplans.show(tp_list_item_venue_permalink,interest, tp_list_item_permalink)
27
34
 
28
- tp_item_full_record = Touringplans.show(tp_list_item.venue_permalink,interest, tp_list_item.permalink)
29
- cache_item.update!(tp_item_full_record.to_h)
35
+ vp = {venue_permalink: tp_list_item_venue_permalink}
36
+ full_record_hash = vp.merge(tp_item_full_record.to_h)
37
+ cache_item.update!(full_record_hash)
38
+ # tp_item_full_record.to_h
39
+ cache_item
30
40
  end
31
41
 
32
42
  # def self.cache_all_hotels
@@ -0,0 +1,17 @@
1
+ #
2
+ #
3
+ # frozen_string_literal: true
4
+
5
+ require 'rails/generators/base'
6
+
7
+ module WdwSources
8
+ module Generators
9
+ class InstallGenerator < Rails::Generators::Base
10
+ def install
11
+ run "bundle install"
12
+ rake "wdw_sources:install:migrations"
13
+ rake "db:migrate"
14
+ end
15
+ end
16
+ end
17
+ end
@@ -1,3 +1,3 @@
1
1
  module WdwSources
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.6'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wdw_sources
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - captproton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-25 00:00:00.000000000 Z
11
+ date: 2021-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -113,7 +113,7 @@ files:
113
113
  - db/migrate/20211024225255_create_wdw_sources_touringplans_dining_venues.rb
114
114
  - db/migrate/20211024225412_create_wdw_sources_touringplans_attractions.rb
115
115
  - db/migrate/20211024225455_create_wdw_sources_touringplans_hotels.rb
116
- - lib/generators/wdw_sources/install_generator.rb
116
+ - lib/generators/wdw_sources/install/install_generator.rb
117
117
  - lib/tasks/wdw_sources_tasks.rake
118
118
  - lib/wdw_sources.rb
119
119
  - lib/wdw_sources/engine.rb
@@ -1,11 +0,0 @@
1
- module WdwSources
2
- class InstallGenerator < Rails::Generator::Base
3
- def install
4
- run "bundle install"
5
- rake "wdw_sources:install:migrations"
6
- rake "db:migrate"
7
- end
8
-
9
- end
10
-
11
- end