Class: Hubspot::BatchResponse

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/hubspot/batch.rb

Overview

exactly the same as a parsed_response but with the status code preserved

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status_code, parsed_response) ⇒ BatchResponse

Returns a new instance of BatchResponse.



10
11
12
13
# File 'lib/hubspot/batch.rb', line 10

def initialize(status_code, parsed_response)
  @status_code = status_code
  super(parsed_response) # Delegate to the parsed response object
end

Instance Attribute Details

#status_codeObject (readonly)

Returns the value of attribute status_code.



8
9
10
# File 'lib/hubspot/batch.rb', line 8

def status_code
  @status_code
end

Instance Method Details

#all_successful?Boolean

Check if all responses were successful (status 200)

Returns:

  • (Boolean)


16
17
18
# File 'lib/hubspot/batch.rb', line 16

def all_successful?
  @status_code == 200
end

#partial_success?Boolean

Check if some responses succeeded and some failed (status 207)

Returns:

  • (Boolean)


21
22
23
# File 'lib/hubspot/batch.rb', line 21

def partial_success?
  @status_code == 207
end