cordial 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/cordial/products.rb +23 -17
- data/lib/cordial/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca629fe17afd35692f72597083ddeb0f1357fbc6
|
4
|
+
data.tar.gz: c804b876ab4b7574db1113f767b574c7c4b27036
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9de75189f76b305c1a0a5d7d8c63dad4a6e4ca7d1d7209b959d0616a256b15e7a1659ce6c5bd0ef27758a85a69e1650b1328ecf3d028e13bc9ece1abea59cb4
|
7
|
+
data.tar.gz: fd498b8a49fb9112bf9214835062de8d28a5986ee58adeae8c39e5d9c8d26169348cfbf35a426a5bb93d5f30cdacc1b8bed57f551dc4a596a8fc1f8be20509a7
|
data/lib/cordial/products.rb
CHANGED
@@ -33,29 +33,35 @@ module Cordial
|
|
33
33
|
end
|
34
34
|
|
35
35
|
# Create a new product.
|
36
|
-
#
|
36
|
+
# options keyword argument is for optional parameters
|
37
|
+
# https://support.cordial.com/hc/en-us/articles/203886098#postProducts
|
37
38
|
# If the product already exists it will be updated.
|
38
39
|
# @example Usage.
|
39
40
|
# Cordial::Products.create(
|
40
41
|
# id: 1,
|
41
42
|
# name: 'Test Product',
|
42
|
-
#
|
43
|
-
#
|
44
|
-
#
|
45
|
-
#
|
46
|
-
#
|
47
|
-
#
|
48
|
-
#
|
49
|
-
#
|
43
|
+
# options: {
|
44
|
+
# price: 99.99,
|
45
|
+
# variants: [{
|
46
|
+
# sku: '123',
|
47
|
+
# attr: {
|
48
|
+
# color: 'red',
|
49
|
+
# size: 'L'
|
50
|
+
# }
|
51
|
+
# }],
|
52
|
+
# inStock: true,
|
53
|
+
# taxable: true,
|
54
|
+
# enabled: true,
|
55
|
+
# properties: {test_metadata: 'my test metadata'}
|
56
|
+
# }
|
50
57
|
# )
|
51
|
-
def self.create(id:, name:,
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
}.to_json)
|
58
|
+
def self.create(id:, name:, options: {})
|
59
|
+
body = {
|
60
|
+
productID: id,
|
61
|
+
productName: name
|
62
|
+
}.merge(options).compact
|
63
|
+
|
64
|
+
client.post('/products', body: body.to_json)
|
59
65
|
end
|
60
66
|
end
|
61
67
|
end
|
data/lib/cordial/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cordial
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Hood
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-08-
|
11
|
+
date: 2018-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|