Class: MediumToWebflow::Medium::Client

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/medium_to_webflow/medium/client.rb

Instance Method Summary collapse

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_postsObject

Raises:



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