Class: ShopifyAPI::Clients::HttpResponse

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/shopify_api/clients/http_response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code:, headers:, body:) ⇒ HttpResponse

Returns a new instance of HttpResponse.



34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/shopify_api/clients/http_response.rb', line 34

def initialize(code:, headers:, body:)
  @code = code
  @headers = headers
  @body = body

  @prev_page_info = T.let(nil, T.nilable(String))
  @next_page_info = T.let(nil, T.nilable(String))
  @prev_page_info, @next_page_info = parse_link_header

  @api_call_limit = T.let(nil, T.nilable(T::Hash[String, Integer]))
  @retry_request_after = T.let(nil, T.nilable(Float))
  @api_call_limit = parse_api_call_limit_header
  @retry_request_after = parse_retry_header
end

Instance Attribute Details

#api_call_limitObject (readonly)

Returns the value of attribute api_call_limit.



22
23
24
# File 'lib/shopify_api/clients/http_response.rb', line 22

def api_call_limit
  @api_call_limit
end

#bodyObject (readonly)

Returns the value of attribute body.



16
17
18
# File 'lib/shopify_api/clients/http_response.rb', line 16

def body
  @body
end

#codeObject (readonly)

Returns the value of attribute code.



10
11
12
# File 'lib/shopify_api/clients/http_response.rb', line 10

def code
  @code
end

#headersObject (readonly)

Returns the value of attribute headers.



13
14
15
# File 'lib/shopify_api/clients/http_response.rb', line 13

def headers
  @headers
end

#next_page_infoObject (readonly)

Returns the value of attribute next_page_info.



19
20
21
# File 'lib/shopify_api/clients/http_response.rb', line 19

def next_page_info
  @next_page_info
end

#prev_page_infoObject (readonly)

Returns the value of attribute prev_page_info.



19
20
21
# File 'lib/shopify_api/clients/http_response.rb', line 19

def prev_page_info
  @prev_page_info
end

#retry_request_afterObject (readonly)

Returns the value of attribute retry_request_after.



25
26
27
# File 'lib/shopify_api/clients/http_response.rb', line 25

def retry_request_after
  @retry_request_after
end

Instance Method Details

#ok?Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/shopify_api/clients/http_response.rb', line 50

def ok?
  code >= 200 && code <= 299
end