Skip to content

Commit e524a03

Browse files
authored
chore: add usage snippet
1 parent a2f8b7d commit e524a03

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,28 @@ gem 'square.rb', '~> 44.0.0'
2828

2929
For more information, see [Using the Square Ruby SDK](https://developer.squareup.com/docs/sdks/ruby/using-ruby-sdk).
3030

31+
```ruby
32+
require "square"
33+
34+
square = Square::Client.new(
35+
token: 'YOUR_API_KEY'
36+
)
37+
38+
image_file = Square::FileParam.from_filepath(
39+
filepath: fixture_path("small.png"),
40+
content_type: "image/png"
41+
)
42+
43+
response = square.invoices.create_invoice_attachment(
44+
invoice_id: "inv:0-ChA4-3sU9GPd-uOC3HgvFjMWEL4N",
45+
request: {
46+
idempotency_key: SecureRandom.uuid,
47+
description: "A test invoice attachment"
48+
},
49+
image_file: image_file
50+
)
51+
```
52+
3153
## Legacy SDK
3254

3355
While the new SDK has a lot of improvements, we at Square understand that it takes time to upgrade when there are breaking changes.

0 commit comments

Comments
 (0)