Sha256: 7f45eda434c0263242c2e78ae44a5eb4cb50c6c9f78896b248977e6a83efe967

Contents?: true

Size: 908 Bytes

Versions: 2

Compression:

Stored size: 908 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
        @names ||= case input
                   when String
                     input
                   when Array
                     input.join(',')
                   else
                     raise ArgumentError
                   end
      end

      def escaped_input
        @escaped_input ||= URI.escape(names)
      end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
eve_online-0.8.0 lib/eve_online/eve/character_id.rb
eve_online-0.7.0 lib/eve_online/eve/character_id.rb