Class: HhApiData::Base
- Inherits:
-
Object
- Object
- HhApiData::Base
- Defined in:
- app/my_lib/hh_api_data/base.rb
Overview
HhApiData::Base
Direct Known Subclasses
Instance Attribute Summary collapse
-
#collections ⇒ Object
readonly
Returns the value of attribute collections.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#page_size ⇒ Object
readonly
Returns the value of attribute page_size.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#per_page ⇒ Object
readonly
Returns the value of attribute per_page.
Instance Method Summary collapse
- #api_call(url_name) ⇒ Object
-
#initialize(id: nil, params: {}) ⇒ Base
constructor
A new instance of Base.
- #pagination(page_params) ⇒ Object
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
#collections ⇒ Object (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 |
#config ⇒ Object (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_size ⇒ Object (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 |
#params ⇒ Object (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_page ⇒ Object (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 |