rdavid1099/poke-api-v2

View on GitHub
lib/poke_api/common/version_encounter_detail.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
module PokeApi
  module Common
    # VersionEncounterDetail object handling lists of version_details
    # relating to encounters and languages
    class VersionEncounterDetail
      include AssignmentHelpers

      attr_reader :encounter_details,
                  :max_chance,
                  :version

      def initialize(data)
        @encounter_details = assign_list(
          data: data[:encounter_details],
          klass: Encounter
        )
        @max_chance        = data[:max_chance]
        @version           = PokeApi::Version.new(data[:version])
      end
    end
  end
end