opossum 0.2.1 → 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: fc7e39df727f7bb72b25088d9dccf4a0926dcaba41c624e27045f455c08650be
4
- data.tar.gz: 32977c12dca6c24b2182e791cb3081705a08fd2b5c76f717ecceb0db03e5e14d
3
+ metadata.gz: f835a756ad086cea7eb54dfbb798975cff69dd6d78b4d2b756a5eb9870818196
4
+ data.tar.gz: ee8f5c575cb49aa93002d00b955fd910029b752aee738464fc13c9d877e069c1
5
5
  SHA512:
6
- metadata.gz: a34ab41b169655e35028138e18cb111810c2ecd4beef2e83fd4b9ecad8b1f3bdc59fb6c1a0cbb124c0bcc5675637095411443472d248fb722dc1e66067bc6865
7
- data.tar.gz: 26319316d4a349ca1c3b0a6663d6e8e6198b714c60a151d800f6bff13a956cd0444e19b6f34a2a69efb29c3531ffed7d045c5cf0321403f931d9c048a54c5cb3
6
+ metadata.gz: cbb2cb21287e5a5bf0547cf826a7c2f0f2fbf38dca6ae6651bec2ccc44190da8b2b2953c36a46be7df521ad565deadfd6e2ebdee988565c454f676e7d138db8e
7
+ data.tar.gz: 94a6445ba81cb9fe6450b600701e54bb69227c7ebb2a147b01857a40907a9e31fd7cd16757fc972c83822f4f517c372f6fd15ea4cf61424dd16f6370f50a350b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ ## [0.3.0] - 2025-08-12
2
+
3
+ ### Improved
4
+ - **Publisher Performance** - Enhanced carousel media processing with parallel execution
5
+ - `prepare_carousel_media` now uses Thread-based parallel processing for media container creation
6
+ - Significantly improved upload speed for carousels with multiple media items
7
+ - Each media URL in carousel is processed concurrently instead of sequentially
8
+ - **Error Handling** - Enhanced Error class with additional error context
9
+ - Added `code` and `subcode` attributes to Error class for better error identification
10
+ - Improved error initialization with optional code and subcode parameters
11
+
1
12
  ## [0.2.1] - 2025-08-07
2
13
 
3
14
  ### Improved
@@ -37,7 +37,7 @@ module Opossum
37
37
 
38
38
  def handle_response(response)
39
39
  parsed_response = parse_json(response.body)
40
- check_api_errors(parsed_response)
40
+ check_api_errors(parsed_response, response.success?)
41
41
  parsed_response
42
42
  rescue Faraday::Error => e
43
43
  raise Opossum::Error, "HTTP Error: #{e.message}"
@@ -49,10 +49,16 @@ module Opossum
49
49
  raise Opossum::Error, "JSON Parse Error: #{e.message}"
50
50
  end
51
51
 
52
- def check_api_errors(parsed_response)
53
- return unless parsed_response["error_message"]
52
+ def check_api_errors(parsed_response, success)
53
+ return if success
54
54
 
55
- raise Opossum::Error, "Instagram API Error: #{parsed_response["error_message"]}"
55
+ error_message = parsed_response["error_message"] || parsed_response.dig("error", "message")
56
+
57
+ raise Opossum::Error.new(
58
+ "Instagram API Error: #{error_message}",
59
+ code: parsed_response.dig("error", "code"),
60
+ subcode: parsed_response.dig("error", "subcode")
61
+ )
56
62
  end
57
63
  end
58
64
  end
@@ -35,10 +35,14 @@ module Opossum
35
35
  end
36
36
 
37
37
  def prepare_carousel_media(media_urls:, media_type:, caption:)
38
- children_ids = media_urls.map do |url|
39
- create_media_container(media_url: url, is_carousel_item: true, caption: caption)
38
+ threads = media_urls.map do |url|
39
+ Thread.new do
40
+ create_media_container(media_url: url, is_carousel_item: true, caption: caption)
41
+ end
40
42
  end
41
43
 
44
+ children_ids = threads.map(&:value)
45
+
42
46
  create_media_container(media_url: children_ids, media_type: media_type, caption: caption)
43
47
  end
44
48
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Opossum
4
- VERSION = "0.2.1"
4
+ VERSION = "0.3.0"
5
5
  end
data/lib/opossum.rb CHANGED
@@ -6,5 +6,15 @@ require_relative "opossum/user_details"
6
6
  require_relative "opossum/publisher"
7
7
 
8
8
  module Opossum
9
- class Error < StandardError; end
9
+ # Custom error class for Opossum gem
10
+ class Error < StandardError
11
+ attr_reader :code, :subcode
12
+
13
+ def initialize(message, code: nil, subcode: nil)
14
+ super(message)
15
+
16
+ @code = code
17
+ @subcode = subcode
18
+ end
19
+ end
10
20
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opossum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vadym Kruchyna
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-08-06 00:00:00.000000000 Z
11
+ date: 2025-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday