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.



28
29
30
31
32
33
34
35
36
# File 'lib/shopify_api/clients/http_response.rb', line 28

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
end

Instance Attribute Details

#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

Instance Method Details

#ok?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/shopify_api/clients/http_response.rb', line 39

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