facebook_commerce 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 20696062e7f6acdd971a438426a5fca169814aa90aa0182dee07e88c5cf77a2f
4
- data.tar.gz: 56837aeacd2b316bb7bcc7ce16351f4dee3fadb91fb766cb13b60ed014ced976
3
+ metadata.gz: da4a245a01e1ca121824f209312955bfc751150dea95b2e42fd96507b38c81c5
4
+ data.tar.gz: b9f9f7d8aec0299c85a239082b64462ec2fcc81ca046c9f8af849a73a9139942
5
5
  SHA512:
6
- metadata.gz: 90425ba85eaf12f79e96ae2db351ac45483e3bcda6260d4cb04ba1d1af2fa9ff36a1bcf9c52d77125a178e95c85deb9403e9eb649eeeef171d4de8b73ed240b3
7
- data.tar.gz: 26afb26eb116a583e12d0515fdfa457729fcf6f568b831a77ffcd70097251627adc64bee59178a87fd5d55ac4cf3746f89f4e0f228362ab2b85acb9b0454b94c
6
+ metadata.gz: ce25dc5f6f0e1925421cba83fa3dbec31572b2cf0f1dc751dc17fcbd9d3004fb954be955f0d1527628806972db75315c91861dce0cea54ca830fc9017b9dc234
7
+ data.tar.gz: f800b085cb6177fb0429e51311fdb3eedbb3c6ea86de8f4b38406166dd78831a6c06f727ef874c1cb0e8d7508863d8b8e39faa1f4325ccf7dafcf90f8aeb6a6c
data/Gemfile CHANGED
@@ -1,10 +1,7 @@
1
- # frozen_string_literal: true
2
-
3
1
  source "https://rubygems.org"
4
2
 
5
- # Specify your gem's dependencies in facebook_commerce.gemspec
6
3
  gemspec
7
4
 
8
5
  gem "rake", "~> 13.0"
9
-
10
6
  gem "rspec", "~> 3.0"
7
+ gem "webmock"
data/README.md CHANGED
@@ -2,17 +2,14 @@
2
2
 
3
3
  Unofficial Ruby wrapper for the Facebook Commerce API.
4
4
 
5
- ## Installation
5
+ [![Version ][rubygems_badge]][rubygems]
6
+ [![Github Actions ][actions_badge]][actions]
6
7
 
7
- TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
8
+ ## Installation
8
9
 
9
10
  Install the gem and add to the application's Gemfile by executing:
10
11
 
11
- $ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
12
-
13
- If bundler is not being used to manage dependencies, install the gem by executing:
14
-
15
- $ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
12
+ $ bundle add facebook_commerce
16
13
 
17
14
  ## Usage
18
15
 
@@ -31,3 +28,8 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/varyon
31
28
  ## License
32
29
 
33
30
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
31
+
32
+ [rubygems_badge]: http://img.shields.io/gem/v/facebook_commerce.svg
33
+ [rubygems]: https://rubygems.org/gems/facebook_commerce
34
+ [actions_badge]: https://github.com/varyonic/facebook_commerce/workflows/main/badge.svg
35
+ [actions]: https://github.com/varyonic/facebook_commerce/actions
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FacebookCommerce
4
- VERSION = "0.1.0"
4
+ VERSION = "0.3.0"
5
5
  end
@@ -22,7 +22,22 @@ module FacebookCommerce
22
22
  class Api
23
23
  class UnexpectedHttpResponse < StandardError
24
24
  def initialize(response)
25
- super response.message || response.code
25
+ message = response.message || response.code
26
+
27
+ # Try to extract error_user_msg from Facebook API response
28
+ if response.body && !response.body.empty?
29
+ begin
30
+ parsed_body = JSON.parse(response.body)
31
+ error_user_msg = parsed_body.dig('error', 'error_user_msg')
32
+ if error_user_msg
33
+ message = "#{message}: #{error_user_msg}"
34
+ end
35
+ rescue JSON::ParserError
36
+ # If JSON parsing fails, just use the original message
37
+ end
38
+ end
39
+
40
+ super message
26
41
  end
27
42
  end
28
43
 
@@ -166,7 +181,7 @@ module FacebookCommerce
166
181
  # @return [Hash] Return response, eg. { id: '1234567890' }
167
182
  def create_return(order_id, items, return_status, return_message, merchant_return_id)
168
183
  data = {
169
- items: items.to_json,
184
+ items: CGI.escape(JSON.generate items),
170
185
  return_status: return_status,
171
186
  return_message: return_message,
172
187
  merchant_return_id: merchant_return_id
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: facebook_commerce
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piers Chambers
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-08-06 00:00:00.000000000 Z
11
+ date: 2025-07-22 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: