Class: Niconico::Mylist::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/niconico/mylist/client.rb

Instance Method Summary collapse

Instance Method Details

#find_xml(id) ⇒ Object


10
11
12
13
14
15
16
17
18
19
# File 'lib/niconico/mylist/client.rb', line 10

def find_xml(id)
  response = faraday.get("/mylist/#{id}?rss=2.0")
  REXML::Document.new(response.body).root
rescue Faraday::Error::ResourceNotFound
  raise Niconico::Mylist::Error::NotFoundError, id
rescue Faraday::Error::ClientError => e
  raise Niconico::Mylist::Error::ForbiddenError, id if e.response.status == 403

  raise e
end