module PKParse # Define a PKParse::Pokemon to keep Rails' model distinct and allow this to be # updated independently without fear of breaking the app. class Pokemon attr_accessor :pokedex_number, :nickname, :raw_nickname, :raw_pokemon def initialize(attributes={}) attributes.each do |attr,v| send("#{attr}=", v) rescue nil end end def to_h { pokedex_number: pokedex_number, nickname: nickname, raw_nickname: raw_nickname, raw_pokemon: raw_pokemon, } end def to_json to_h end end end