dooca_commerce 1.0.3 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cf1c826816b46f397e0b43fb5022589c99a321375c281d8bde9242404a12e108
4
- data.tar.gz: 45f33a1578c46546b90d60b633ea0eade64419fb475e50a7b1c09109b71c57b8
3
+ metadata.gz: f2ef96abbacc085d54da98f7b01e7eddf76a8cf828f708c18fdca2e9ceb953c3
4
+ data.tar.gz: efffdc00fc890996eceff0c26e7a0000aab25ea28dc9c74706052642957c16a6
5
5
  SHA512:
6
- metadata.gz: 702025e5c85b16a57c56a7daaaf72e3d377cbd982807170f51e92419408b2c2a173e589a40a1aef2052e06d634e7b8fd6494eb6956774b14466ddf71a6ce49d5
7
- data.tar.gz: e1931a6d934435f63a7d0abb684a6dff6bab53c7b1b0dc19570e3fdbf6ff8848be7630544d1e6278089f52582def00188433bae8f6cbf701fc1777901b5dc0de
6
+ metadata.gz: 19b72c6b0961678d5a18289f6212b6e907e736eeebac7db58b52f6fc998569268046f8d98c62f001d477f5c533b8485e86a6877b9034566a3a5434f2e12ca531
7
+ data.tar.gz: fc70541b5c1b48a8a9ebacf5093d8106fbf9117166bcd7e21cfbed7e7305baa502dbf65ea781e8908ab0452caa5be82552baae50ca5c2aba764b54f8b228fb11
@@ -46,6 +46,18 @@ class DoocaCommerce
46
46
  handler.new(response).parse!
47
47
  end
48
48
 
49
+ def fetch_orders(query = {})
50
+ response = connection.get("/orders", query)
51
+
52
+ handler.new(response).parse!
53
+ end
54
+
55
+ def fetch_order(order_id:)
56
+ response = connection.get("/orders/#{order_id}")
57
+
58
+ handler.new(response).parse!
59
+ end
60
+
49
61
  def fetch_colors(query = {})
50
62
  response = connection.get("/colors", query)
51
63
 
@@ -148,6 +160,42 @@ class DoocaCommerce
148
160
  handler.new(response).parse!
149
161
  end
150
162
 
163
+ def create_fulfillment(order_id:)
164
+ response = connection.post("/orders/#{order_id}/fulfillment")
165
+
166
+ handler.new(response).parse!
167
+ end
168
+
169
+ def update_invoice(order_id:, body:)
170
+ response = connection.put("/orders/#{order_id}/fulfillment/invoiced", body.to_json)
171
+
172
+ handler.new(response).parse!
173
+ end
174
+
175
+ def update_tracking(order_id:, body:)
176
+ response = connection.put("/orders/#{order_id}/fulfillment/shipped", body.to_json)
177
+
178
+ handler.new(response).parse!
179
+ end
180
+
181
+ def mark_as_delivered(order_id:)
182
+ response = connection.put("/orders/#{order_id}/fulfillment/delivered")
183
+
184
+ handler.new(response).parse!
185
+ end
186
+
187
+ def delete_image(product_id:, image_id:)
188
+ response = connection.delete("/products/#{product_id}/images/#{image_id}")
189
+
190
+ handler.new(response).parse!
191
+ end
192
+
193
+ def create_image(product_id:, body:)
194
+ response = connection.post("/products/#{product_id}/images", body.to_json)
195
+
196
+ handler.new(response).parse!
197
+ end
198
+
151
199
  private
152
200
 
153
201
  URL = "https://api.dooca.store"
@@ -28,7 +28,7 @@ class ResponseHandler
28
28
  end
29
29
 
30
30
  def payload
31
- @payload ||= JSON.parse(response.body, object_class: OpenStruct)
31
+ @payload ||= JSON.parse(response.body.presence || "{}", object_class: OpenStruct)
32
32
  end
33
33
 
34
34
  def success?
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dooca_commerce
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luciano Cesar Cordeiro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-14 00:00:00.000000000 Z
11
+ date: 2022-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday