Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
strategy:
matrix:
operating-system: [ubuntu-latest]
version: ['3.0', '3.2']
version: ['3.0', '3.1', '3.2', '3.3', '3.4', 'head']
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -16,12 +16,11 @@ jobs:
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.version }}
bundler-cache: true

- name: Before install
run: gem install bundler -v "< 2.0"

- name: Bundle install
run: bundle install
- name: Run RSpec
continue-on-error: ${{ matrix.ruby == 'head' }}
run: bundle exec rspec

- name: Gem build
run: gem build *.gemspec
1 change: 1 addition & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--require spec_helper
5 changes: 5 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
source "https://rubygems.org"

gemspec

# `money` gem dependency that's wrongly required by them
# Should be removed after the next `money` release that include [0]
# [0] https://github.com/RubyMoney/money/commit/815b6187ca0ede892d7d48ff5e633a2f811f9285
gem 'bigdecimal'
26 changes: 25 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
PATH
remote: .
specs:
facebookbusiness (22.0.0)
facebookbusiness (22.0.1)
concurrent-ruby (~> 1.1)
countries (>= 3, < 7)
faraday (~> 2.6)
faraday-multipart (~> 1.0, >= 1.0.4)
json (~> 2.6)
logger
money (~> 6.13)
ostruct

GEM
remote: https://rubygems.org/
specs:
ast (2.4.2)
awesome_print (1.9.2)
bigdecimal (3.1.9)
byebug (11.1.3)
coderay (1.1.3)
concurrent-ruby (1.3.3)
coolline (0.5.0)
unicode_utils (~> 1.4)
countries (5.7.2)
unaccent (~> 0.3)
date (3.4.1)
diff-lcs (1.5.0)
dotenv (2.8.1)
faraday (2.9.2)
Expand All @@ -31,26 +35,43 @@ GEM
net-http
i18n (1.14.5)
concurrent-ruby (~> 1.0)
io-console (0.8.0)
irb (1.15.2)
pp (>= 0.6.0)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
json (2.7.2)
logger (1.7.0)
method_source (1.0.0)
minitest (5.14.4)
money (6.19.0)
i18n (>= 0.6.4, <= 2)
multipart-post (2.4.1)
net-http (0.4.1)
uri
ostruct (0.6.1)
parallel (1.22.1)
parser (3.2.0.0)
ast (~> 2.4.1)
pp (0.6.2)
prettyprint
prettyprint (0.2.0)
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
pry-coolline (0.2.6)
coolline (~> 0.5)
pry (~> 0.13)
psych (5.2.3)
date
stringio
rainbow (3.1.1)
rake (13.0.6)
rdoc (6.13.1)
psych (>= 4.0.0)
regexp_parser (2.6.2)
reline (0.6.1)
io-console (~> 0.5)
rexml (3.3.3)
strscan
rspec (3.12.0)
Expand Down Expand Up @@ -78,6 +99,7 @@ GEM
rubocop-ast (1.24.1)
parser (>= 3.1.1.0)
ruby-progressbar (1.11.0)
stringio (3.1.7)
strscan (3.1.0)
unaccent (0.4.0)
unicode-display_width (1.8.0)
Expand All @@ -91,10 +113,12 @@ PLATFORMS

DEPENDENCIES
awesome_print (~> 1.8)
bigdecimal
bundler (~> 2.2)
byebug (~> 11.0)
dotenv (~> 2.7)
facebookbusiness!
irb
minitest (~> 5.14.2)
pry (~> 0.12)
pry-coolline (~> 0.2)
Expand Down
3 changes: 3 additions & 0 deletions facebookbusiness.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ Gem::Specification.new do |s|
s.add_dependency 'json', '~> 2.6'
s.add_dependency 'countries', '>= 3', '< 7'
s.add_dependency 'money', '~> 6.13'
s.add_dependency 'logger'
s.add_dependency 'ostruct'

s.add_development_dependency 'awesome_print', '~> 1.8'
s.add_development_dependency 'bundler', '~> 2.2'
Expand All @@ -51,6 +53,7 @@ Gem::Specification.new do |s|
s.add_development_dependency 'rake', '~> 13.0'
s.add_development_dependency 'rspec', '~> 3.8'
s.add_development_dependency 'rubocop', '~> 0.71'
s.add_development_dependency 'irb'

s.files = Dir['LICENSE.txt', 'README.md', 'lib/**/*', 'bin/*']
s.executables = s.files.grep(%r{^bin/}).map { |f| File.basename(f) }
Expand Down
4 changes: 2 additions & 2 deletions lib/facebook_ads/ad_objects/server_side/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -411,10 +411,10 @@ def normalize
hash['messaging_channel'] = messaging_channel
end
unless original_event_data.nil?
hash['original_event_data'] = original_event_data
hash['original_event_data'] = original_event_data.normalize
end
unless attribution_data.nil?
hash['attribution_data'] = attribution_data
hash['attribution_data'] = attribution_data.normalize
end
hash
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@
)

expect(attribution_data.normalize).to eq({
'scope': scope,
'visit_time': visit_time,
'ad_id': ad_id,
'adset_id': adset_id,
'campaign_id': campaign_id,
'attr_window': attr_window,
'attribution_share': attribution_share,
'attribution_model': attribution_model,
'scope' => scope,
'visit_time' => visit_time,
'ad_id' => ad_id,
'adset_id' => adset_id,
'campaign_id' => campaign_id,
'attr_window' => attr_window,
'attribution_share' => attribution_share,
'attribution_model' => attribution_model,
})
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@
messages: 'message3',
fbtrace_id: 'fbtrace123',
}
expected_response = FacebookAds::ServerSide::EventResponse.new(response)
expected_response = FacebookAds::ServerSide::EventResponse.new(**response)
expect(mock_ads_pixel).to receive_message_chain('events.create').with(expected_params).and_return(response)
expect(FacebookAds::AdsPixel).to receive(:get).with(event_request_async.pixel_id).and_return(mock_ads_pixel)
expect(FacebookAds::AdsPixel).to receive(:get).with(event_request_async.pixel_id, nil).and_return(mock_ads_pixel)
promise = event_request_async.execute
response = promise.value!

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@
messages: 'message3',
fbtrace_id: 'fbtrace123',
}
expected_response = FacebookAds::ServerSide::EventResponse.new(response)
expected_response = FacebookAds::ServerSide::EventResponse.new(**response)
expect(mock_ads_pixel).to receive_message_chain('events.create').with(expected_params).and_return(response)
expect(FacebookAds::AdsPixel).to receive(:get).with(event_request.pixel_id).and_return(mock_ads_pixel)
expect(FacebookAds::AdsPixel).to receive(:get).with(event_request.pixel_id, nil).and_return(mock_ads_pixel)
response = event_request.execute

expect(response).to eq(expected_response)
Expand All @@ -159,9 +159,9 @@
messages: 'message3',
fbtrace_id: 'fbtrace123',
}
expected_response = FacebookAds::ServerSide::EventResponse.new(response)
expected_response = FacebookAds::ServerSide::EventResponse.new(**response)
expect(mock_ads_pixel).to receive_message_chain('events.create').with(expected_params).and_return(response)
expect(FacebookAds::AdsPixel).to receive(:get).with(event_request.pixel_id).and_return(mock_ads_pixel)
expect(FacebookAds::AdsPixel).to receive(:get).with(event_request.pixel_id, nil).and_return(mock_ads_pixel)
response = event_request.execute

expect(response).to eq(expected_response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
allow(FacebookAds::ServerSide::Util).to receive(:normalize) do |input, field_type|
"#{field_type}_#{input}-normalized"
end
user_data = FacebookAds::ServerSide::UserData.new(attrs)
user_data = FacebookAds::ServerSide::UserData.new(**attrs)
normalized = user_data.normalize

expect(normalized).to eq(
Expand Down Expand Up @@ -83,7 +83,7 @@
allow(FacebookAds::ServerSide::Util).to receive(:normalize_array) do |input, field_type|
input + [field_type]
end
user_data = FacebookAds::ServerSide::UserData.new(attrs)
user_data = FacebookAds::ServerSide::UserData.new(**attrs)
normalized = user_data.normalize

expect(normalized).to eq(
Expand Down Expand Up @@ -216,8 +216,8 @@
expect(user_data1).to eq(user_data2)
expect(user_data1.hash).to eq(user_data2.hash)

user_data1 = FacebookAds::ServerSide::UserData.new(attrs)
user_data2 = FacebookAds::ServerSide::UserData.new(attrs)
user_data1 = FacebookAds::ServerSide::UserData.new(**attrs)
user_data2 = FacebookAds::ServerSide::UserData.new(**attrs)
expect(user_data1).to eq(user_data2)
expect(user_data1.hash).to eq(user_data2.hash)
end
Expand Down
Loading