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 +4 -4
- data/CHANGELOG.md +11 -0
- data/lib/opossum/api_helper.rb +10 -4
- data/lib/opossum/publisher.rb +6 -2
- data/lib/opossum/version.rb +1 -1
- data/lib/opossum.rb +11 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f835a756ad086cea7eb54dfbb798975cff69dd6d78b4d2b756a5eb9870818196
|
4
|
+
data.tar.gz: ee8f5c575cb49aa93002d00b955fd910029b752aee738464fc13c9d877e069c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/opossum/api_helper.rb
CHANGED
@@ -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
|
52
|
+
def check_api_errors(parsed_response, success)
|
53
|
+
return if success
|
54
54
|
|
55
|
-
|
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
|
data/lib/opossum/publisher.rb
CHANGED
@@ -35,10 +35,14 @@ module Opossum
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def prepare_carousel_media(media_urls:, media_type:, caption:)
|
38
|
-
|
39
|
-
|
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
|
|
data/lib/opossum/version.rb
CHANGED
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
|
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.
|
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-
|
11
|
+
date: 2025-08-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|