Skip to content

Commit

Permalink
remove create_and_buy from batch (#202)
Browse files Browse the repository at this point in the history
  • Loading branch information
jchen293 authored Nov 30, 2023
1 parent 5466456 commit d24726e
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 94 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## Next major release

- Removes the undocumented `CreateAndBuy` function from the Batch service. The proper usage is to create a batch first and buy it separately

## v3.2.0 (2023-10-11)

- Add `GetAPIKeysForUser` under API Key service to retrieve API keys for a specific user ID
Expand Down
14 changes: 0 additions & 14 deletions batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,6 @@ func (c *Client) CreateBatchWithContext(ctx context.Context, in ...*Shipment) (o
return
}

// CreateAndBuyBatch creates and buys a new batch of shipments in one request.
func (c *Client) CreateAndBuyBatch(in ...*Shipment) (out *Batch, err error) {
return c.CreateAndBuyBatchWithContext(context.Background(), in...)
}

// CreateAndBuyBatchWithContext performs the same operation as
// CreateAndBuyBatch, but allows specifying a context that can interrupt the
// request.
func (c *Client) CreateAndBuyBatchWithContext(ctx context.Context, in ...*Shipment) (out *Batch, err error) {
req := batchRequest{Batch: &Batch{Shipments: in}}
err = c.post(ctx, "batches/create_and_buy", req, &out)
return
}

// ListBatches provides a paginated result of Insurance objects.
func (c *Client) ListBatches(opts *ListOptions) (out *ListBatchesResult, err error) {
return c.ListBatchesWithContext(context.Background(), opts)
Expand Down
2 changes: 1 addition & 1 deletion examples
Submodule examples updated 484 files
12 changes: 0 additions & 12 deletions tests/batch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,6 @@ func (c *ClientTests) TestBatchAll() {
}
}

func (c *ClientTests) TestBatchCreateAndBuy() {
client := c.TestClient()
assert, require := c.Assert(), c.Require()

batch, err := client.CreateAndBuyBatch(c.fixture.OneCallBuyShipment(), c.fixture.OneCallBuyShipment())
require.NoError(err)

assert.Equal(reflect.TypeOf(&easypost.Batch{}), reflect.TypeOf(batch))
assert.True(strings.HasPrefix(batch.ID, "batch_"))
assert.Equal(2, batch.NumShipments)
}

func (c *ClientTests) TestBatchBuy() {
client := c.TestClient()
assert, require := c.Assert(), c.Require()
Expand Down
67 changes: 0 additions & 67 deletions tests/cassettes/TestBatchCreateAndBuy.yaml

This file was deleted.

0 comments on commit d24726e

Please sign in to comment.