Skip to content

Commit 290d57e

Browse files
thomasmarshallfacebook-github-bot
authored andcommitted
Replace deprecated UploadIO constant (facebook#204)
Summary: This constant was deprecated in `multipart-post` v2.2.0 [1] but `faraday-multipart` v1.0.4 introduced a workaround to avoid the deprecated constant warning [2]. This commit switches out `UploadIO` references to use the `Faraday` namespaced one. [1]: socketry/multipart-post@cb18a32 [2]: lostisland/faraday-multipart@2127a0c Pull Request resolved: facebook#204 Reviewed By: mengxuanzhangz Differential Revision: D52926662 Pulled By: stcheng fbshipit-source-id: b999d59c992b0351924bdfb10d33ab34de788c69
1 parent 3df6b28 commit 290d57e

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

facebookbusiness.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Gem::Specification.new do |s|
3636

3737
s.add_dependency 'concurrent-ruby', '~> 1.1'
3838
s.add_dependency 'faraday', '~> 2.6'
39-
s.add_dependency 'faraday-multipart', '~> 1.0'
39+
s.add_dependency 'faraday-multipart', '~> 1.0.4'
4040
s.add_dependency 'json', '~> 2.6'
4141
s.add_dependency 'countries', '>= 3', '< 6'
4242
s.add_dependency 'money', '~> 6.13'

lib/facebook_ads/api_request.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,14 @@ def batch_body
9797
# For Batch API
9898
def params_without_files
9999
params.reject do |_,v|
100-
v.is_a?(UploadIO)
100+
v.is_a?(Faraday::UploadIO)
101101
end
102102
end
103103

104104
# For Batch API
105105
def files
106106
params.select do |_,v|
107-
v.is_a?(UploadIO)
107+
v.is_a?(Faraday::UploadIO)
108108
end
109109
end
110110
end

lib/facebook_ads/field_types/upload_file.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ def serialize(value)
7777
if category == :video
7878
FacebookAds::VideoIO.new(value, content_type)
7979
else
80-
::UploadIO.new(value, content_type)
80+
Faraday::UploadIO.new(value, content_type)
8181
end
82-
when UploadIO
82+
when Faraday::UploadIO
8383
value
8484
# when etc etc TODO Rails/Sinatra Upload
8585
else
@@ -98,7 +98,7 @@ def content_type_for(ext)
9898
end
9999

100100
def self.acceptable?(value)
101-
[File, Tempfile, UploadIO].each do |type|
101+
[File, Tempfile, Faraday::UploadIO].each do |type|
102102
return true if value.is_a?(type)
103103
end
104104

lib/facebook_ads/videos/video_io.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
require 'faraday/multipart'
88

99
module FacebookAds
10-
class VideoIO < ::UploadIO
10+
class VideoIO < Faraday::UploadIO
1111
def is_video?
1212
true
1313
end

0 commit comments

Comments
 (0)