Sha256: 9a385fc6559351b64a5400b5eb8ffd4ca2fa2b71ce81e581d7162d1a70db1018

Contents?: true

Size: 801 Bytes

Versions: 4

Compression:

Stored size: 801 Bytes

Contents

require 'uri'

module EveOnline
  module Eve
    # https://eveonline-third-party-documentation.readthedocs.org/en/latest/xmlapi/eve/eve_characterid.html
    class CharacterID < BaseXML
      API_ENDPOINT = 'https://api.eveonline.com/eve/CharacterID.xml.aspx'.freeze

      attr_reader :input

      def initialize(input)
        super()
        @input = input
      end

      def characters
        # TODO: implement
        raise NotImplementedError
      end

      def names
        case input
        when String
          input
        when Array
          input.join(',')
        else
          raise ArgumentError
        end
      end

      def escaped_input
        URI.escape(names)
      end

      def url
        "#{ API_ENDPOINT }?names=#{ escaped_input }"
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
eve_online-0.12.0 lib/eve_online/eve/character_id.rb
eve_online-0.11.0 lib/eve_online/eve/character_id.rb
eve_online-0.10.0 lib/eve_online/eve/character_id.rb
eve_online-0.9.0 lib/eve_online/eve/character_id.rb