Sha256: 612aae0018942a3017b6632d5ba319f81ee7723d3dc02abf68d34b932e2ad74a

Contents?: true

Size: 1.02 KB

Versions: 2

Compression:

Stored size: 1.02 KB

Contents

require 'jikan/models/entity'

module Jikan
  class User < BaseEntity
    def name
      raw['username']
    end
    
    def url
      raw['url']
    end

    def image_url
      raw['image_url']
    end

    def birthday
      raw['birthday']
    end

    def location
      raw['location']
    end

    def joined
      raw['joined']
    end
    
    def about
      raw['about']
    end

    def anime_stats
      raw['anime_stats']
    end

    def manga_stats
      raw['manga_stats']
    end

    def fav_anime
      raw['favorites']['anime'].map do |fa|
        Jikan::BasicAnime.new(fa)
      end
    end

    def fav_manga
      raw['favorites']['manga'].map do |fm|
        Jikan::BasicManga.new(fm)
      end
    end

    def fav_char
      raw['favorites']['characters'].map do |fc|
        Jikan::BasicCharacter.new(fc)
      end
    end

    def fav_people
      raw['favorites']['people'].map do |fp|
        Jikan::BasicPerson.new(fp)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jikan.rb-0.0.7 lib/jikan/models/user.rb
jikan.rb-0.0.6 lib/jikan/models/user.rb