Class: Increase::Resources::Simulations::PhysicalCards

Inherits:
Object
  • Object
show all
Defined in:
lib/increase/resources/simulations/physical_cards.rb,
sig/increase/resources/simulations/physical_cards.rbs

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ PhysicalCards

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of PhysicalCards.

Parameters:

API:

  • private



75
76
77
# File 'lib/increase/resources/simulations/physical_cards.rb', line 75

def initialize(client:)
  @client = client
end

Instance Method Details

#advance_shipment(physical_card_id, shipment_status:, request_options: {}) ⇒ Increase::Models::PhysicalCard

This endpoint allows you to simulate advancing the shipment status of a Physical Card, to simulate e.g., that a physical card was attempted to be shipped but then failed delivery.

Parameters:

  • The Physical Card you would like to action.

  • The shipment status to move the Physical Card to.

Returns:

See Also:



61
62
63
64
65
66
67
68
69
70
# File 'lib/increase/resources/simulations/physical_cards.rb', line 61

def advance_shipment(physical_card_id, params)
  parsed, options = Increase::Simulations::PhysicalCardAdvanceShipmentParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["simulations/physical_cards/%1$s/advance_shipment", physical_card_id],
    body: parsed,
    model: Increase::PhysicalCard,
    options: options
  )
end

#create(physical_card_id, category:, carrier_estimated_delivery_at: nil, city: nil, postal_code: nil, state: nil, request_options: {}) ⇒ Increase::Models::PhysicalCard

This endpoint allows you to simulate receiving a tracking update for a Physical Card, to simulate the progress of a shipment.

Parameters:

  • The Physical Card you would like to action.

  • The type of tracking event.

  • The ISO 8601 date and time when the carrier expects the card to be delivered.

  • The city where the event took place. Required if postal_code is not provided.

  • The postal code where the event took place. Required unless both city and state are provided.

  • The state where the event took place. Required if postal_code is not provided.

Returns:

See Also:



34
35
36
37
38
39
40
41
42
43
# File 'lib/increase/resources/simulations/physical_cards.rb', line 34

def create(physical_card_id, params)
  parsed, options = Increase::Simulations::PhysicalCardCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["simulations/physical_cards/%1$s/tracking_updates", physical_card_id],
    body: parsed,
    model: Increase::PhysicalCard,
    options: options
  )
end