Class: Tinyletter::Newsletter

Inherits:
Object
  • Object
show all
Defined in:
lib/tinyletter/newsletter.rb

Constant Summary collapse

BASE_ENDPOINT =
'http://tinyletter.com/'.freeze

Instance Method Summary collapse

Constructor Details

#initialize(username, params = {}) ⇒ Newsletter

Returns a new instance of Newsletter.



11
12
13
14
15
# File 'lib/tinyletter/newsletter.rb', line 11

def initialize(username, params = {})
  @username = username
  @with_archive = params[:with_archive] || false
  initialize_http_client
end

Instance Method Details

#metadataObject



17
18
19
20
21
22
23
24
25
26
# File 'lib/tinyletter/newsletter.rb', line 17

def 
  return  unless .nil?

  begin
    page = get(BASE_ENDPOINT + @username)
     = (page)
  rescue Mechanize::ResponseCodeError => e
    { error: e }
  end
end