Class: HhApiData::Base

Inherits:
Object
  • Object
show all
Defined in:
app/my_lib/hh_api_data/base.rb

Overview

HhApiData::Base

Direct Known Subclasses

Restaurant

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id: nil, params: {}) ⇒ Base

Returns a new instance of Base.



5
6
7
8
9
# File 'app/my_lib/hh_api_data/base.rb', line 5

def initialize(id: nil, params: {})
  @params = params
  @config = {}
  @config[:id] = id.present? ? "/#{URI.encode_www_form_component(id)}" : ''
end

Instance Attribute Details

#collectionsObject (readonly)

Returns the value of attribute collections.



3
4
5
# File 'app/my_lib/hh_api_data/base.rb', line 3

def collections
  @collections
end

#configObject (readonly)

Returns the value of attribute config.



3
4
5
# File 'app/my_lib/hh_api_data/base.rb', line 3

def config
  @config
end

#page_sizeObject (readonly)

Returns the value of attribute page_size.



3
4
5
# File 'app/my_lib/hh_api_data/base.rb', line 3

def page_size
  @page_size
end

#paramsObject (readonly)

Returns the value of attribute params.



3
4
5
# File 'app/my_lib/hh_api_data/base.rb', line 3

def params
  @params
end

#per_pageObject (readonly)

Returns the value of attribute per_page.



3
4
5
# File 'app/my_lib/hh_api_data/base.rb', line 3

def per_page
  @per_page
end

Instance Method Details

#api_call(url_name) ⇒ Object



11
12
13
14
# File 'app/my_lib/hh_api_data/base.rb', line 11

def api_call(url_name)
  query = build_graphql_query
  response = get_hh_search(query)
end

#pagination(page_params) ⇒ Object



16
17
18
19
# File 'app/my_lib/hh_api_data/base.rb', line 16

def pagination(page_params)
  @page_size = page_params[:size]
  @per_page = page_params[:number]
end