eivid 1.0.8 → 1.1.0

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: 18c4c4d966bf527f9b36d9d30fa7f0bd1a78cbe85ed82ed02264c2b15c23b022
4
- data.tar.gz: 79899e7a07874171fba933e51a53bf4d5b6d9a531300ee6b59ac39f8fdd09070
3
+ metadata.gz: e1abba7ac763f6e2406fa273b7d7e945a34a41af4ca60ffd8b17c1832d8c0541
4
+ data.tar.gz: 429afe91f85be846405a12868e8ef6faccf188c62014b5a1e6fdad8f07c8c353
5
5
  SHA512:
6
- metadata.gz: 4b4c8890c237800b56c5bad688fc025a1fb2ed4b835afdb103435281dd421d14587a35f99265f8fdd0073e72c5ba8ffebaf6ce4dc6bbb88b509aa48052661f7a
7
- data.tar.gz: 3016c7ad6bac8c16a5369516840269d53ce45f5c25a5f92fedebe16a042fd56324e01c23a8a1f018bb16cfed07c683c46250fadce006285d3df70f91537be56d
6
+ metadata.gz: cee95248e9bb3578baa7ed4ff90f9ee2d0f6df01018e4625094528c795e5ba33c25edc59ce488af8b565a223152ac45393c122b43169148edb95eb698fabc925
7
+ data.tar.gz: b00e818a801b2077eb461bdfe8feeb92b0c61687e4744e50180b7398f5b2158d1a76e7823e76b5ce758d6a976b169cb760cc380212b3cf66e5afd016c9cf891f
@@ -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)
@@ -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.8'
2
+ VERSION = '1.1.0'
3
3
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eivid
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.8
4
+ version: 1.1.0
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-23 00:00:00.000000000 Z
11
+ date: 2021-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 5.2.3
19
+ version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 5.2.3
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: httparty
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -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