Class: HotsApi::Fetcher

Inherits:
Object
  • Object
show all
Defined in:
lib/hots_api/fetcher.rb

Constant Summary collapse

ApiLimitReachedError =
Class.new(StandardError)

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#last_responseObject (readonly)

Returns the value of attribute last_response.



9
10
11
# File 'lib/hots_api/fetcher.rb', line 9

def last_response
  @last_response
end

Instance Method Details

#get(path, params: {}) ⇒ Object



11
12
13
14
15
# File 'lib/hots_api/fetcher.rb', line 11

def get(path, params: {})
  with_retrying do
    HTTP.get("#{base_path}/#{path}", params: params)
  end
end

#post(path, body: nil, file: nil) ⇒ Object



17
18
19
20
21
# File 'lib/hots_api/fetcher.rb', line 17

def post(path, body: nil, file: nil)
  with_retrying do
    HTTP.post("#{base_path}/#{path}", post_options_for(body: body, file: file))
  end
end