opossum 0.2.0 → 0.2.1
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 +10 -0
- data/README.md +11 -1
- data/lib/opossum/api_helper.rb +2 -6
- data/lib/opossum/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc7e39df727f7bb72b25088d9dccf4a0926dcaba41c624e27045f455c08650be
|
4
|
+
data.tar.gz: 32977c12dca6c24b2182e791cb3081705a08fd2b5c76f717ecceb0db03e5e14d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a34ab41b169655e35028138e18cb111810c2ecd4beef2e83fd4b9ecad8b1f3bdc59fb6c1a0cbb124c0bcc5675637095411443472d248fb722dc1e66067bc6865
|
7
|
+
data.tar.gz: 26319316d4a349ca1c3b0a6663d6e8e6198b714c60a151d800f6bff13a956cd0444e19b6f34a2a69efb29c3531ffed7d045c5cf0321403f931d9c048a54c5cb3
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
## [0.2.1] - 2025-08-07
|
2
|
+
|
3
|
+
### Improved
|
4
|
+
- **Instagram API Response Handling** - Enhanced error handling and response processing
|
5
|
+
- Improved JSON parsing with better error messages when API returns invalid JSON
|
6
|
+
- Added specific Instagram API error detection and messaging via `error_message` field
|
7
|
+
- Enhanced HTTP error handling with more descriptive error messages
|
8
|
+
- Better separation of concerns in ApiHelper with dedicated private methods for response processing
|
9
|
+
- More robust error handling chain: HTTP errors → JSON parsing errors → Instagram API errors
|
10
|
+
|
1
11
|
## [0.2.0] - 2025-08-06
|
2
12
|
|
3
13
|
### Changed
|
data/README.md
CHANGED
@@ -131,7 +131,7 @@ result = publisher.publish_media(
|
|
131
131
|
|
132
132
|
## Error Handling
|
133
133
|
|
134
|
-
The gem includes comprehensive error handling for API responses:
|
134
|
+
The gem includes comprehensive error handling for API responses with enhanced Instagram API error detection:
|
135
135
|
|
136
136
|
```ruby
|
137
137
|
begin
|
@@ -145,9 +145,19 @@ begin
|
|
145
145
|
)
|
146
146
|
rescue Opossum::Error => e
|
147
147
|
puts "Error: #{e.message}"
|
148
|
+
# Examples of error messages:
|
149
|
+
# "HTTP Error: Connection failed"
|
150
|
+
# "JSON Parse Error: Unexpected token"
|
151
|
+
# "Instagram API Error: Invalid media URL"
|
148
152
|
end
|
149
153
|
```
|
150
154
|
|
155
|
+
**Error Handling Features:**
|
156
|
+
- **HTTP Error Detection** - Catches network and connection issues with descriptive messages
|
157
|
+
- **JSON Parsing** - Handles malformed API responses with clear error descriptions
|
158
|
+
- **Instagram API Errors** - Automatically detects and reports Instagram-specific errors via `error_message` field
|
159
|
+
- **Error Chain Processing** - Processes errors in logical order: HTTP → JSON → Instagram API
|
160
|
+
|
151
161
|
## Supported Media Types
|
152
162
|
|
153
163
|
- **IMAGE** - Single images (JPEG, PNG) with optional caption
|
data/lib/opossum/api_helper.rb
CHANGED
@@ -36,8 +36,6 @@ module Opossum
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def handle_response(response)
|
39
|
-
raise Opossum::Error, "HTTP #{response.status}: #{response.body}" unless response.success?
|
40
|
-
|
41
39
|
parsed_response = parse_json(response.body)
|
42
40
|
check_api_errors(parsed_response)
|
43
41
|
parsed_response
|
@@ -52,11 +50,9 @@ module Opossum
|
|
52
50
|
end
|
53
51
|
|
54
52
|
def check_api_errors(parsed_response)
|
55
|
-
return unless parsed_response["
|
53
|
+
return unless parsed_response["error_message"]
|
56
54
|
|
57
|
-
|
58
|
-
error_message += " - #{parsed_response["error_description"]}" if parsed_response["error_description"]
|
59
|
-
raise Opossum::Error, error_message
|
55
|
+
raise Opossum::Error, "Instagram API Error: #{parsed_response["error_message"]}"
|
60
56
|
end
|
61
57
|
end
|
62
58
|
end
|
data/lib/opossum/version.rb
CHANGED