Class: EveOnline::ESI::Search

Inherits:
Base
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/eve_online/esi/search.rb

Constant Summary collapse

API_PATH =
"/v2/search/"
DEFAULT_CATEGORIES =
[
  "agent",
  "alliance",
  "character",
  "constellation",
  "corporation",
  "faction",
  "inventory_type",
  "region",
  "solar_system",
  "station"
]

Constants inherited from Base

Base::API_HOST

Instance Attribute Summary collapse

Attributes inherited from Base

#_open_timeout, #_read_timeout, #_write_timeout, #adapter, #language, #middlewares, #token

Instance Method Summary collapse

Methods inherited from Base

#add_middleware, #base_query_params, #connection, #error_limit_remain, #error_limit_reset, #http_method, #open_timeout, #open_timeout=, #page, #query, #read_timeout, #read_timeout=, #request_id, #resource, #response, #total_pages, #uri, #url, #user_agent, #write_timeout, #write_timeout=

Constructor Details

#initialize(options) ⇒ Search

Returns a new instance of Search.



27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/eve_online/esi/search.rb', line 27

def initialize(options)
  super

  @search = options.fetch(:search)
  @strict = options.fetch(:strict, false)
  @raw_categories = options.fetch(:categories, DEFAULT_CATEGORIES)
  @raw_categories.each do |c|
    unless DEFAULT_CATEGORIES.include?(c)
      raise(ArgumentError)
    end
  end
  @categories = @raw_categories.join(",")
end

Instance Attribute Details

#categoriesObject (readonly)

Returns the value of attribute categories.



25
26
27
# File 'lib/eve_online/esi/search.rb', line 25

def categories
  @categories
end

#raw_categoriesObject (readonly)

Returns the value of attribute raw_categories.



25
26
27
# File 'lib/eve_online/esi/search.rb', line 25

def raw_categories
  @raw_categories
end

#searchObject (readonly)

Returns the value of attribute search.



25
26
27
# File 'lib/eve_online/esi/search.rb', line 25

def search
  @search
end

#strictObject (readonly)

Returns the value of attribute strict.



25
26
27
# File 'lib/eve_online/esi/search.rb', line 25

def strict
  @strict
end

Instance Method Details

#additional_query_paramsObject



52
53
54
# File 'lib/eve_online/esi/search.rb', line 52

def additional_query_params
  [:search, :categories, :strict]
end

#modelObject



45
46
47
# File 'lib/eve_online/esi/search.rb', line 45

def model
  @model ||= Models::Search.new(response)
end

#pathObject



56
57
58
# File 'lib/eve_online/esi/search.rb', line 56

def path
  format(API_PATH, search: search, categories: categories, strict: strict)
end

#scopeObject



49
50
# File 'lib/eve_online/esi/search.rb', line 49

def scope
end