Class: TransparentData::Actions::Search

Inherits:
Object
  • Object
show all
Defined in:
lib/transparent_data/actions/search.rb

Constant Summary collapse

COUNTRY_TO_KEY_MAP =
{
  finland: :fi,
  czech: :cz,
  denmark: :dk,
  norway: :no,
  slovakia: :sk,
  uk: :uk
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, country, query_str) ⇒ Search

Returns a new instance of Search.



15
16
17
18
19
# File 'lib/transparent_data/actions/search.rb', line 15

def initialize(client, country, query_str)
  @client = client
  @country = country
  @query_str = query_str
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



13
14
15
# File 'lib/transparent_data/actions/search.rb', line 13

def client
  @client
end

#countryObject (readonly)

Returns the value of attribute country.



13
14
15
# File 'lib/transparent_data/actions/search.rb', line 13

def country
  @country
end

#query_strObject (readonly)

Returns the value of attribute query_str.



13
14
15
# File 'lib/transparent_data/actions/search.rb', line 13

def query_str
  @query_str
end

Instance Method Details

#callObject



21
22
23
24
25
# File 'lib/transparent_data/actions/search.rb', line 21

def call
  search_method = "#{fetch_country_id(country)}Search"

  TransparentData::Request.call(client, search_method, query: build_query(query_str))
end