File tree Expand file tree Collapse file tree 4 files changed +21
-20
lines changed Expand file tree Collapse file tree 4 files changed +21
-20
lines changed Original file line number Diff line number Diff line change @@ -114,23 +114,24 @@ client.objects.update(
114114)
115115
116116# Batch create objects
117- client.objects.batch_create(objects: [
117+ response = client.objects.batch_create(objects: [
118118 {
119- class_name : " Question" ,
119+ class : " Question" ,
120120 properties: {
121121 answer: " 42" ,
122122 question: " What is the meaning of life?" ,
123123 category: " philosophy"
124124 }
125125 }, {
126- class_name : " Question" ,
126+ class : " Question" ,
127127 properties: {
128128 answer: " 42" ,
129129 question: " What does 6 times 7 equal to?" ,
130130 category: " math"
131131 }
132132 }
133133])
134+ response.data
134135```
135136
136137## Development
Original file line number Diff line number Diff line change @@ -50,7 +50,10 @@ def batch_create(objects:)
5050 response = client . connection . post ( "batch/#{ PATH } " ) do |req |
5151 req . body = { objects : objects }
5252 end
53- Response ::Collection . from_response ( response , key : "objects" , type : Response ::Object )
53+
54+ if response . success?
55+ Response ::Collection . from_response ( response , type : Response ::Object )
56+ end
5457 end
5558
5659 # Get a single data object.
Original file line number Diff line number Diff line change 1- {
2- "objects" : [
3- {
4- "class" : " Question" ,
5- "creationTimeUnix" : 1679757150769 ,
6- "id" : " 123" ,
7- "lastUpdateTimeUnix" : 1679757150769 ,
8- "properties" : {
9- "answer" : " 42" ,
10- "category" : " philosophy" ,
11- "question" : " What is the meaning of life?"
12- }
1+ [
2+ {
3+ "class" : " Question" ,
4+ "creationTimeUnix" : 1679757150769 ,
5+ "id" : " 123" ,
6+ "lastUpdateTimeUnix" : 1679757150769 ,
7+ "properties" : {
8+ "answer" : " 42" ,
9+ "category" : " philosophy" ,
10+ "question" : " What is the meaning of life?"
1311 }
14- ],
15- "totalResults" : 1
16- }
12+ }
13+ ]
Original file line number Diff line number Diff line change 3737 end
3838
3939 describe "#list" do
40- let ( :response ) { OpenStruct . new ( body : objects_fixture ) }
40+ let ( :response ) { OpenStruct . new ( body : { "objects" => objects_fixture } ) }
4141
4242 before do
4343 allow_any_instance_of ( Faraday ::Connection ) . to receive ( :get )
You can’t perform that action at this time.
0 commit comments