dooca_commerce 1.0.2 → 1.0.3

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: 89deab28dafe36c32e9d8f1f815ef436c86915c950a5f700e7606cc17205f825
4
- data.tar.gz: a25a163f6f1acf4b93bb89c8e97cecfdab762420144680ff9db2bc530e8d2008
3
+ metadata.gz: cf1c826816b46f397e0b43fb5022589c99a321375c281d8bde9242404a12e108
4
+ data.tar.gz: 45f33a1578c46546b90d60b633ea0eade64419fb475e50a7b1c09109b71c57b8
5
5
  SHA512:
6
- metadata.gz: 4c09a5439a6fd13595ce6da57a180c231d815b43264f2ca3c7984923ac0673d9e8f7ffdd3d252224f7a2935083ab572a34ea5abf333f1b6fa636bbdb2aacfa07
7
- data.tar.gz: ace2e794f17ea50a2465939a9f1cc2bec46bffd41dd0441d1002e33770ae816a0ccbd5366bdcaf8f19e3cbc02bac136c0bfa8009a8590c2719fa72b9307d2d35
6
+ metadata.gz: 702025e5c85b16a57c56a7daaaf72e3d377cbd982807170f51e92419408b2c2a173e589a40a1aef2052e06d634e7b8fd6494eb6956774b14466ddf71a6ce49d5
7
+ data.tar.gz: e1931a6d934435f63a7d0abb684a6dff6bab53c7b1b0dc19570e3fdbf6ff8848be7630544d1e6278089f52582def00188433bae8f6cbf701fc1777901b5dc0de
@@ -34,12 +34,120 @@ class DoocaCommerce
34
34
  handler.new(response, single_from_list: true).parse!
35
35
  end
36
36
 
37
- def update_stock_and_price(product_id:, body:)
37
+ def fetch_categories(query = {})
38
+ response = connection.get("/categories", query)
39
+
40
+ handler.new(response).parse!
41
+ end
42
+
43
+ def fetch_category(category_id:)
44
+ response = connection.get("/categories/#{category_id}")
45
+
46
+ handler.new(response).parse!
47
+ end
48
+
49
+ def fetch_colors(query = {})
50
+ response = connection.get("/colors", query)
51
+
52
+ handler.new(response).parse!
53
+ end
54
+
55
+ def fetch_brands(query = {})
56
+ response = connection.get("/brands", query)
57
+
58
+ handler.new(response).parse!
59
+ end
60
+
61
+ def fetch_attributes(query = {})
62
+ response = connection.get("/attributes", query)
63
+
64
+ handler.new(response).parse!
65
+ end
66
+
67
+ def create_product(body)
68
+ response = connection.post("/products", body.to_json)
69
+
70
+ handler.new(response).parse!
71
+ end
72
+
73
+ def update_product(product_id:, body:)
38
74
  response = connection.put("/products/#{product_id}", body.to_json)
39
75
 
40
76
  handler.new(response).parse!
41
77
  end
42
78
 
79
+ def create_variation(body)
80
+ response = connection.post("/variations", body.to_json)
81
+
82
+ handler.new(response).parse!
83
+ end
84
+
85
+ def update_variation(variation_id:, body:)
86
+ response = connection.put("/variations/#{variation_id}", body.to_json)
87
+
88
+ handler.new(response).parse!
89
+ end
90
+
91
+ def create_category(body)
92
+ response = connection.post("/categories", body.to_json)
93
+
94
+ handler.new(response).parse!
95
+ end
96
+
97
+ def update_category(category_id:, body:)
98
+ response = connection.put("/categories/#{category_id}", body.to_json)
99
+
100
+ handler.new(response).parse!
101
+ end
102
+
103
+ def create_brand(body)
104
+ response = connection.post("/brands", body.to_json)
105
+
106
+ handler.new(response).parse!
107
+ end
108
+
109
+ def update_brand(brand_id:, body:)
110
+ response = connection.put("/brands/#{brand_id}", body.to_json)
111
+
112
+ handler.new(response).parse!
113
+ end
114
+
115
+ def create_color(body)
116
+ response = connection.post("/colors", body.to_json)
117
+
118
+ handler.new(response).parse!
119
+ end
120
+
121
+ def update_color(color_id:, body:)
122
+ response = connection.put("/colors/#{color_id}", body.to_json)
123
+
124
+ handler.new(response).parse!
125
+ end
126
+
127
+ def create_attribute(body)
128
+ response = connection.post("/attributes", body.to_json)
129
+
130
+ handler.new(response).parse!
131
+ end
132
+
133
+ def update_attribute(attribute_id:, body:)
134
+ response = connection.put("/attributes/#{attribute_id}", body.to_json)
135
+
136
+ handler.new(response).parse!
137
+ end
138
+
139
+ def create_attribute_value(body)
140
+ response = connection.post("/attributes/values", body.to_json)
141
+
142
+ handler.new(response).parse!
143
+ end
144
+
145
+ def update_attribute_value(attribute_value_id:, body:)
146
+ response = connection.put("/attributes/values/#{attribute_value_id}", body.to_json)
147
+
148
+ handler.new(response).parse!
149
+ end
150
+
43
151
  private
44
152
 
45
153
  URL = "https://api.dooca.store"
@@ -32,6 +32,6 @@ class ResponseHandler
32
32
  end
33
33
 
34
34
  def success?
35
- single_from_list ? payload.data&.first.present? : (response.status == 200)
35
+ single_from_list ? payload.data&.first.present? : (200..204).include?(response.status)
36
36
  end
37
37
  end
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.2
4
+ version: 1.0.3
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: 2021-12-27 00:00:00.000000000 Z
11
+ date: 2022-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday