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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 466cb3b575e4774b3f376e426b493aa48f3d013741a0c68ef888889106cdc3b1
4
- data.tar.gz: dac123033aa98814a3622c67ccf654b3dd0957ebe61f21cd6de278e346733276
3
+ metadata.gz: 19f7a05a13d5fc9d5f3b715714f8a5a00cd1c65f9b7eaafd9f3d0e30e5e18870
4
+ data.tar.gz: 2591191f53c9c90e29cbba33bfd034f35034885655af2a7d2fbff42b3144b204
5
5
  SHA512:
6
- metadata.gz: 43bddc77a19ee9ddcd1366424d4f80b9470afef6651e096cf8e4d130a4aeb1564347e6d70e7c93765470aacbd1f6c5d8d44208d32aba9b2d3c23cf13008ecada
7
- data.tar.gz: 9b1669a899386b52b6958e5fc626cd447f18e1b6d72222e5a4a31cf08b0b7534347617c3aaf1418f754fcd94382b191791b16f6355985c261ee43a6bcd9be43e
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 => conf['view'],:fields => conf['fields'])
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.7
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-03-29 00:00:00.000000000 Z
11
+ date: 2023-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll