webflow_sync 3.1.2 → 4.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/jobs/webflow_sync/create_item_job.rb +1 -1
- data/app/jobs/webflow_sync/update_item_job.rb +1 -1
- data/app/models/concerns/webflow_sync/callbacks.rb +5 -5
- data/app/services/webflow_sync/api.rb +4 -1
- data/lib/generators/webflow_sync/collection_generator.rb +1 -1
- data/lib/webflow_sync/version.rb +1 -1
- metadata +19 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a15354ad9d036d149529ea1724b0819d000346791e427e7a4899a8f094cf4bf2
|
4
|
+
data.tar.gz: 94b84584db65b07817f6a16d37f7932d56dc2f8af6e1326ffa41943ffca4bc2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8856556ec7258d9b842d9bad88ddd19c105805772796596bcd0e445d314ab7ae54499ebb9c88dc384582eab9034c9066b36a0e275392a1016195fab570731e1
|
7
|
+
data.tar.gz: 5e3c4daed7f24824bbe475056e2451f8419d2bddc0095b26f5ac828dc27cb908a0f5d5646b42e9f5be5a2e959cf91e3ff1aec85a86f0b2ea6a1468f638dcb861
|
@@ -12,7 +12,7 @@ module WebflowSync
|
|
12
12
|
# model_name = 'articles'; id = article.id, collection_slug = 'stories'
|
13
13
|
def perform(model_name, id, collection_slug = model_name.underscore.dasherize.pluralize)
|
14
14
|
model_class = model_name.underscore.classify.constantize
|
15
|
-
record = model_class.find_by(id:
|
15
|
+
record = model_class.find_by(id:)
|
16
16
|
return if record.blank?
|
17
17
|
return if record.webflow_site_id.blank?
|
18
18
|
|
@@ -8,7 +8,7 @@ module WebflowSync
|
|
8
8
|
# 'job_listing'.underscore.dasherize.pluralize => 'job-listings'
|
9
9
|
def perform(model_name, id, collection_slug = model_name.underscore.dasherize.pluralize)
|
10
10
|
model_class = model_name.underscore.classify.constantize
|
11
|
-
record = model_class.find_by(id:
|
11
|
+
record = model_class.find_by(id:)
|
12
12
|
return if record.blank?
|
13
13
|
return if record.webflow_site_id.blank?
|
14
14
|
return WebflowSync::CreateItemJob.perform_now(model_name, id, collection_slug) if record.webflow_item_id.blank?
|
@@ -13,24 +13,24 @@ module WebflowSync
|
|
13
13
|
after_commit :destroy_webflow_item, on: :destroy
|
14
14
|
|
15
15
|
def create_webflow_item
|
16
|
-
return if self.skip_webflow_sync ||
|
16
|
+
return if WebflowSync.configuration.skip_webflow_sync || self.skip_webflow_sync || self.webflow_site_id.blank?
|
17
17
|
|
18
18
|
WebflowSync::CreateItemJob.perform_later(self.model_name.collection, self.id)
|
19
19
|
end
|
20
20
|
|
21
21
|
def update_webflow_item
|
22
|
-
return if self.skip_webflow_sync ||
|
22
|
+
return if WebflowSync.configuration.skip_webflow_sync || self.skip_webflow_sync || self.webflow_site_id.blank?
|
23
23
|
|
24
24
|
WebflowSync::UpdateItemJob.perform_later(self.model_name.collection, self.id)
|
25
25
|
end
|
26
26
|
|
27
27
|
def destroy_webflow_item
|
28
|
-
return if self.skip_webflow_sync ||
|
28
|
+
return if WebflowSync.configuration.skip_webflow_sync || self.skip_webflow_sync || self.webflow_site_id.blank?
|
29
29
|
|
30
|
-
# Make sure slug is in the
|
30
|
+
# Make sure slug is in the plural form, and multiple words slug separated by dashes
|
31
31
|
collection_slug = self.model_name.collection.underscore.dasherize
|
32
32
|
|
33
|
-
WebflowSync::DestroyItemJob.perform_later(collection_slug
|
33
|
+
WebflowSync::DestroyItemJob.perform_later(collection_slug:,
|
34
34
|
webflow_site_id: self.webflow_site_id,
|
35
35
|
webflow_item_id: self.webflow_item_id)
|
36
36
|
end
|
@@ -1,5 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'webflow/client'
|
4
|
+
require 'webflow/error'
|
5
|
+
|
3
6
|
module WebflowSync
|
4
7
|
class Api
|
5
8
|
attr_reader :site_id
|
@@ -82,7 +85,7 @@ module WebflowSync
|
|
82
85
|
def publish
|
83
86
|
return unless WebflowSync.configuration.publish_on_sync
|
84
87
|
|
85
|
-
response = make_request(:publish, site_id, domain_names:
|
88
|
+
response = make_request(:publish, site_id, domain_names:)
|
86
89
|
|
87
90
|
puts "Publish all domains for Webflow site with id: #{site_id}"
|
88
91
|
response
|
@@ -12,7 +12,7 @@ module WebflowSync
|
|
12
12
|
include Rails::Generators::Migration
|
13
13
|
def add_migration
|
14
14
|
migration_template 'migration.rb.erb', "#{migration_path}/add_webflow_item_id_to_#{table_name}.rb",
|
15
|
-
migration_version:
|
15
|
+
migration_version:
|
16
16
|
end
|
17
17
|
|
18
18
|
def include_item_sync_in_model_file
|
data/lib/webflow_sync/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webflow_sync
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Viktor
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: net-smtp
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: pry-rails
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -172,6 +186,7 @@ licenses:
|
|
172
186
|
metadata:
|
173
187
|
homepage_uri: https://github.com/vfonic/webflow_sync
|
174
188
|
source_code_uri: https://github.com/vfonic/webflow_sync
|
189
|
+
rubygems_mfa_required: 'true'
|
175
190
|
post_install_message:
|
176
191
|
rdoc_options: []
|
177
192
|
require_paths:
|
@@ -180,14 +195,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
180
195
|
requirements:
|
181
196
|
- - ">="
|
182
197
|
- !ruby/object:Gem::Version
|
183
|
-
version: '
|
198
|
+
version: '3.1'
|
184
199
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
185
200
|
requirements:
|
186
201
|
- - ">="
|
187
202
|
- !ruby/object:Gem::Version
|
188
203
|
version: '0'
|
189
204
|
requirements: []
|
190
|
-
rubygems_version: 3.
|
205
|
+
rubygems_version: 3.3.17
|
191
206
|
signing_key:
|
192
207
|
specification_version: 4
|
193
208
|
summary: Keep Rails models in sync with WebFlow.
|