Sha256: 9cc18ed80cf4e5b52813df66705b6586c4e105145114667ac60536c70417264a

Contents?: true

Size: 960 Bytes

Versions: 1

Compression:

Stored size: 960 Bytes

Contents

module EveOnline
  module Account
    # http://wiki.eve-id.net/APIv2_Account_Characters_XML
    class Characters < Base
      API_ENDPOINT = 'https://api.eveonline.com/account/Characters.xml.aspx'

      attr_reader :key_id, :v_code

      def initialize(key_id, v_code)
        super()
        @key_id = key_id
        @v_code = v_code
      end

      def version
        eveapi.fetch('@version').to_i
      end

      def characters
        case row
        when Hash
          [EveOnline::Character.new(row)]
        when Array
          output = []
          row.each do |character|
            output << EveOnline::Character.new(character)
          end
          output
        else
          raise ArgumentError
        end
      end

      def row
        rowset.fetch('row')
      end

      def rowset
        result.fetch('rowset')
      end

      def url
        "#{ API_ENDPOINT}?keyID=#{ key_id }&vCode=#{ v_code }"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
eve_online-0.4.0 lib/eve_online/account/characters.rb