Class: MediumToWebflow::Medium::Client
- Inherits:
-
Object
- Object
- MediumToWebflow::Medium::Client
- Includes:
- HTTParty
- Defined in:
- lib/medium_to_webflow/medium/client.rb
Instance Method Summary collapse
- #fetch_posts ⇒ Object
-
#initialize(username:) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(username:) ⇒ Client
Returns a new instance of Client.
12 13 14 |
# File 'lib/medium_to_webflow/medium/client.rb', line 12 def initialize(username:) @username = username end |
Instance Method Details
#fetch_posts ⇒ Object
16 17 18 19 20 21 |
# File 'lib/medium_to_webflow/medium/client.rb', line 16 def fetch_posts response = self.class.get("/#{@username}") raise Error, "Failed to fetch Medium posts: #{response.code}" unless response.success? parse_feed(response.body) end |