Class: DearInventory::TestResponse

Inherits:
Response
  • Object
show all
Extended by:
IsASubclass, T::Sig
Defined in:
lib/dear_inventory/test_response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from IsASubclass

is_a?

Methods inherited from Response

#each, #error, #fields, #headers, #next_page, #next_page?, #num_records_paged, #paginated?, #raise_not_paginated, #success?, #uri

Constructor Details

#initialize(request:, body:, num_previous_records: 0) ⇒ TestResponse

Returns a new instance of TestResponse.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/dear_inventory/test_response.rb', line 22

def initialize(request:, body:, num_previous_records: 0)
  @request = T.let(request, DearInventory::Models::Request)
  @num_previous_records = T.let(num_previous_records, Integer)

  @fields = T.let(nil, T.nilable(T::Array[Symbol]))
  @http_status = T.let(nil, T.nilable(Integer))
  @load_full_record = T.let(nil, T.nilable(T::Boolean))
  @num_records_paged = T.let(nil, T.nilable(Integer))
  @uri = T.let(nil, T.nilable(String))

  raise_error unless success?

  @model = T.let(@request.model.new(body), DearInventory::Model)
  assign_values
end

Instance Attribute Details

#requestObject (readonly)

Returns the value of attribute request.



10
11
12
# File 'lib/dear_inventory/test_response.rb', line 10

def request
  @request
end

#responseObject (readonly)

Returns the value of attribute response.



12
13
14
# File 'lib/dear_inventory/test_response.rb', line 12

def response
  @response
end

Instance Method Details

#http_statusObject



40
41
42
# File 'lib/dear_inventory/test_response.rb', line 40

def http_status
  200
end