jekyll-airtable-import 0.1.7 → 0.1.8
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/lib/jekyll-airtable-import.rb +6 -2
- 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: 19f7a05a13d5fc9d5f3b715714f8a5a00cd1c65f9b7eaafd9f3d0e30e5e18870
|
4
|
+
data.tar.gz: 2591191f53c9c90e29cbba33bfd034f35034885655af2a7d2fbff42b3144b204
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c219ab9758256cd91a7036e2c40856237f240c5bfa025af34a292089f3d4da46f9e17adf72023fc005461eec5ebde1a8b970aa64aed41633ef32a56e77bcc5c
|
7
|
+
data.tar.gz: f08e37dce69e2b5e13463c5c37be09aec764fd11925b9a72291fd73d15413a4058ba2c235ecae9b4a3f4e2b9e7e080ea3f070f402edd572e66bc13b3829dbb55
|
@@ -15,7 +15,7 @@ module Airtable
|
|
15
15
|
def download_attachment(at_attachment)
|
16
16
|
ext = ".#{at_attachment['type'].split('/')[-1]}" if at_attachment['type'].is_a? String
|
17
17
|
ext ||= ''
|
18
|
-
file_name = "#{at_attachment['filename']}#{ext}"
|
18
|
+
file_name = "#{at_attachment['filename']}-#{at_attachment['id']}#{ext}"
|
19
19
|
|
20
20
|
Dir.mkdir "#{Dir.pwd}/assets" unless Dir.exists? "#{Dir.pwd}/assets"
|
21
21
|
assets_dir = Dir.mkdir "#{Dir.pwd}/assets/airtable" unless Dir.exists? "#{Dir.pwd}/assets/airtable"
|
@@ -72,6 +72,7 @@ module Airtable
|
|
72
72
|
@client = Airtable::Client.new(api_key)
|
73
73
|
@app_id = nil
|
74
74
|
@table_id = nil
|
75
|
+
@view_id = nil
|
75
76
|
site.config['airtable'].each do |name, conf|
|
76
77
|
conf ||= Hash.new
|
77
78
|
if conf['app']
|
@@ -89,11 +90,14 @@ module Airtable
|
|
89
90
|
Jekyll.logger.warn @log_name, "No table ID for Airtable import of #{name}"
|
90
91
|
next
|
91
92
|
end
|
93
|
+
if conf['view']
|
94
|
+
@view_id = conf['view'][0..3] == 'ENV_' ? ENV[conf['view'][4..-1]] : conf['view']
|
95
|
+
end
|
92
96
|
Jekyll.logger.debug @log_name, "Importing #{name} from https://airtable.com/#{@app_id}/#{@table_id}/#{conf['view']}"
|
93
97
|
# Pass in the app key and table name
|
94
98
|
@table = @client.table(@app_id, @table_id)
|
95
99
|
# Get records where the Published field is checked
|
96
|
-
@records = @table.all(:view =>
|
100
|
+
@records = @table.all(:view => @view_id,:fields => conf['fields'])
|
97
101
|
Jekyll.logger.debug @log_name, "Found #{@records.length} records to import for #{name}"
|
98
102
|
# Extract data to a hash
|
99
103
|
data = @records.map { |record| record.attributes }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-airtable-import
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- joe-irving
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|