Sha256: 39510c0b5144bbc6b425b9472d9b454dd3fd48e15eedbbb3cf926a85031269d4

Contents?: true

Size: 622 Bytes

Versions: 1

Compression:

Stored size: 622 Bytes

Contents

module MyAnimeList
  class Manga

    def initialize(options={})
      @myanimelist_username = options[:username]
      @myanimelist_password = options[:password]
    end

    def search(name)
      get_search(name)
    end

    def get_search(name)
      response = RestClient::Request.new(
        method: :get,
        url: "http://myanimelist.net/api/manga/search.xml?q=#{CGI::escape name}",
        user: @myanimelist_username,
        password: @myanimelist_password,
        content_type: :xml ).execute

      parse_xml response
    end

    def parse_xml(response)
      Hash.from_xml response
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
myanimelist-0.0.3 lib/myanimelist/manga.rb