eivid 1.0.7 → 1.0.11

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: b995a651b9c7d8ae829041db1b2dcb8bd272ff646687db1b714d4c71f01f4892
4
- data.tar.gz: e9142b432d08eb85f21217965af5ddca7a5ba4962401a219e0c4f236980072a4
3
+ metadata.gz: 1c2573ee732c9660e3c9b52490c88794016a64f6ccd7a8c6597bc268b43a80ce
4
+ data.tar.gz: 0f64fccb5e8bfff65937a883fc6c1a35540744379d3dcad007a42e450759dc1c
5
5
  SHA512:
6
- metadata.gz: 9b48dadeee80c0bee563b30e5852016b7e23184d08a494ceca635aa3f160721c5ba8b0e41e9d32bb9be7a0eafc9c61273d1bc1c8a07b89985b8a5f96de4b40c4
7
- data.tar.gz: 67500bcd2c6723eaa6900aaef6a6b31786c0adb64b6fcd12ccdf11962d77f8d388058dc170957ef68020d89f448c1a20f9dbdb8cef4f7236dfb1270fd5a186d3
6
+ metadata.gz: bc28ea6273a2bdbe73813ef3010cf38f21923374c30e07aceeb41a0ccb0e23e6f322e28aff970ceea8163ffaa8ce83d84d7b99ba87932d5a509763ad8af580d4
7
+ data.tar.gz: d352dc738178f1cb2f154d2f95fcf0b46c3dce8eff280f6bca9721ff0e58c68f5725e5ff21161d64251ebad8495f2f34db53e3757a3f2cbd7a462fbdab7a8ceb
@@ -0,0 +1,14 @@
1
+ module Eivid
2
+ class RequestFolderIdJob < ApplicationJob
3
+
4
+ def perform(eivid_owner_id)
5
+
6
+ owner = Owner.find(eivid_owner_id)
7
+ folder_id = RequestService.create_folder(namespace: Eivid.owner_model, id: owner.id)
8
+
9
+ owner.update!(folder_id: folder_id)
10
+
11
+ end
12
+
13
+ end
14
+ end
@@ -7,7 +7,7 @@ module Eivid::Concerns::MainApp::Owner
7
7
 
8
8
  include Eivid::Concerns::MainApp::VideoConcerns
9
9
 
10
- after_create :create_eivid_owner
10
+ after_commit :create_eivid_owner, on: :create
11
11
 
12
12
  def create_eivid_owner
13
13
  Eivid::Owner.create(external_id: self.id)
@@ -12,5 +12,7 @@ module Eivid::Concerns::MainApp::VideoConcerns
12
12
  scope :has_processed_video, -> { joins(:videos).where('eivid_videos.uploaded': true).distinct }
13
13
  scope :has_unprocessed_video, -> { joins(:videos).where('eivid_videos.uploaded' => false).distinct }
14
14
 
15
+ scope :has_video_from_user, -> (user_id) { joins(:videos).where('eivid_videos.user_id = ?', user_id) }
16
+
15
17
  end
16
18
  end
@@ -6,7 +6,7 @@ module Eivid::Concerns::RequestService::ManageFolder
6
6
  end
7
7
 
8
8
  def create_folder(namespace:, id:)
9
- body = { "name" => "#{Rails.env}_#{namespace}_#{id}" }
9
+ body = { "name" => "#{rails_environment}_#{namespace}_#{id}" }
10
10
 
11
11
  @response = HTTParty.post Eivid::RequestService::FOLDER_URL, body: body.to_json, headers: default_headers
12
12
  get_folder_id
@@ -20,6 +20,11 @@ module Eivid::Concerns::RequestService::ManageFolder
20
20
  HTTParty.put endpoint, headers: default_headers
21
21
  end
22
22
 
23
+ def rails_environment
24
+ return "test" if Figaro.env.IS_TEST_SERVER
25
+ Rails.env
26
+ end
27
+
23
28
  private
24
29
 
25
30
  def get_folder_id
@@ -5,16 +5,16 @@ module Eivid
5
5
 
6
6
  validates :external_id, presence: true, uniqueness: true
7
7
 
8
- before_create :get_folder_id
8
+ after_commit :get_folder_id, unless: :folder_id
9
9
 
10
- belongs_to :"#{Eivid.owner_model}", foreign_key: "external_id"
10
+ belongs_to :"#{Eivid.owner_model}", foreign_key: "external_id", optional: true
11
11
 
12
12
  def external_owner
13
13
  send Eivid.owner_model
14
14
  end
15
15
 
16
16
  def get_folder_id
17
- self.folder_id = RequestService.create_folder(namespace: Eivid.owner_model, id: self.external_id)
17
+ RequestFolderIdJob.perform_later(self.id)
18
18
  end
19
19
 
20
20
  end
data/lib/eivid/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Eivid
2
- VERSION = '1.0.7'
2
+ VERSION = '1.0.11'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eivid
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jurriaan Schrofer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-19 00:00:00.000000000 Z
11
+ date: 2021-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -80,6 +80,7 @@ files:
80
80
  - app/jobs/eivid/get_vimeo_hd_url_job.rb
81
81
  - app/jobs/eivid/get_vimeo_urls_job.rb
82
82
  - app/jobs/eivid/get_vimeo_urls_mixin.rb
83
+ - app/jobs/eivid/request_folder_id_job.rb
83
84
  - app/jobs/eivid/upload_vimeo_job.rb
84
85
  - app/mailers/eivid/application_mailer.rb
85
86
  - app/models/eivid/application_record.rb