webflow_sync 0.2.2 → 0.3.1

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: '008eacb6d73cdf03f36749df62fcdf48b68c59430c8aef274e8711cef46c2bab'
4
- data.tar.gz: 2b802a58ab2f1b29bcb5bbd9731b9b4c0cc19798cd40bbe11304520ed9080a2f
3
+ metadata.gz: 651ec5a8ddb34444092eeb0f05807287eefa5427c346caecc7256d67071d80ac
4
+ data.tar.gz: faa3ba27c9e1d6244dcf99ebfab0229354612e11f103e18af5311155738c1bf7
5
5
  SHA512:
6
- metadata.gz: da35c26f4b754220b0d95f7b29889bd1ccf43ab26f9378e0ce4cbdb7cd911a212498d3b44b5b4557624430862e289ece374de642c0f758b9a3ac5f141e6acbb5
7
- data.tar.gz: dec5b2f89ec60203db3a29f3bb7dff0431fe66734a214c3e897ec998d55a6c88ca2ab7c74501b2e22c339d5c7daf584118e4304e599facb040223a29c7f155dc
6
+ metadata.gz: 3eed7f9c4cfc3f8d095b3bacdf5d53b36bac4df2e6814d59ccfed42a2ad96c5825d3c448c4e15929018d4e01e8441e1b7ca031680241bf626f777b41aea3e538
7
+ data.tar.gz: f6805e73191bae71db5b4732de53a946bc4858b78a3ffbd62d90a8145c816645fc7193e4006e77ea6f029c2a716f7b3d7e2af270704367c6d08b9e40d12d20bf
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
- ![build](https://github.com/vfonic/webflow_sync/workflows/build/badge.svg)
1
+ [![Build Status](https://github.com/vfonic/webflow_sync/workflows/build/badge.svg)](https://github.com/vfonic/webflow_sync/actions)
2
+
2
3
 
3
4
  # WebflowSync
4
5
 
@@ -7,7 +7,7 @@ module WebflowSync
7
7
  record = model_class.find_by(id: id)
8
8
  return if record.blank?
9
9
  return if record.webflow_site_id.blank?
10
- return if record.webflow_item_id.blank?
10
+ return WebflowSync::CreateItemJob.perform_now(collection_slug, id) if record.webflow_item_id.blank?
11
11
 
12
12
  WebflowSync::Api.new(record.webflow_site_id).update_item(record, collection_slug)
13
13
  end
@@ -8,9 +8,9 @@ module WebflowSync
8
8
  included do
9
9
  attr_accessor :skip_webflow_sync
10
10
 
11
- after_create :create_webflow_item
12
- after_update :update_webflow_item
13
- after_destroy :destroy_webflow_item
11
+ after_commit :create_webflow_item, on: :create
12
+ after_commit :update_webflow_item, on: :update
13
+ after_commit :destroy_webflow_item, on: :destroy
14
14
 
15
15
  def create_webflow_item
16
16
  return if self.skip_webflow_sync || WebflowSync.configuration.skip_webflow_sync
@@ -9,7 +9,7 @@ module WebflowSync
9
9
  yield(self.configuration)
10
10
 
11
11
  self.configuration.api_token ||= ENV.fetch('WEBFLOW_API_TOKEN')
12
- self.configuration.skip_webflow_sync ||= Rails.env.test?
12
+ defined?(self.configuration.skip_webflow_sync) or self.configuration.skip_webflow_sync = !Rails.env.production?
13
13
  end
14
14
 
15
15
  private
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WebflowSync
4
- VERSION = '0.2.2'
4
+ VERSION = '0.3.1'
5
5
  end
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: 0.2.2
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Viktor
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-01 00:00:00.000000000 Z
11
+ date: 2021-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -173,7 +173,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
173
173
  - !ruby/object:Gem::Version
174
174
  version: '0'
175
175
  requirements: []
176
- rubygems_version: 3.2.3
176
+ rubygems_version: 3.2.11
177
177
  signing_key:
178
178
  specification_version: 4
179
179
  summary: Keep Rails models in sync with WebFlow.