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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 28f90ba90661894c077eb72004e0300f07e9c2d93059d8221985c396b467b74e
4
- data.tar.gz: 29afd0da8dd9f9192caeea525f92365637b75d15816fca846a0a577049ea56d9
3
+ metadata.gz: fc7e39df727f7bb72b25088d9dccf4a0926dcaba41c624e27045f455c08650be
4
+ data.tar.gz: 32977c12dca6c24b2182e791cb3081705a08fd2b5c76f717ecceb0db03e5e14d
5
5
  SHA512:
6
- metadata.gz: cf6f1c1f02604906beb4ea09fb3af644ede569c4ec9dcf962a6f2d851f2ee5fbfedd4a2ade0831b0a677b8ae78e51ced66a919eb12237820658b74014c150d5f
7
- data.tar.gz: ccba27fcb4c858e825ca63f494ab97d6246e58078a4369274373170dab71cb11e20dcec00789e924dc52312c696f1073b740a27bd76e99c6e3659dc6e49227c8
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
@@ -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["error"]
53
+ return unless parsed_response["error_message"]
56
54
 
57
- error_message = "Instagram API Error: #{parsed_response["error"]}"
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Opossum
4
- VERSION = "0.2.0"
4
+ VERSION = "0.2.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opossum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vadym Kruchyna