cordial 0.1.7 → 0.1.8

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
  SHA1:
3
- metadata.gz: 173005820b79f9ce0a13a682ef3f18d1b1f741c5
4
- data.tar.gz: df7a0d035bae3b43e2da586830dd0df8a587417b
3
+ metadata.gz: ca629fe17afd35692f72597083ddeb0f1357fbc6
4
+ data.tar.gz: c804b876ab4b7574db1113f767b574c7c4b27036
5
5
  SHA512:
6
- metadata.gz: a8e0cb1a93f75cc315c8e3d2a841ac3080d6cfd7132eeecdf98943fc86d60259527d2c7933e69b0752a1aef06b83bde105f26e86c407d7fb7dfe4f7479ef1a1d
7
- data.tar.gz: 3d8f8441b4096efab3cae880ae532ef2d004fa7b819ad17df8d7c58a16e7189f36666eefbdb25f8189fed823867eb29ded1faec8aaec15249174554c3acbc445
6
+ metadata.gz: e9de75189f76b305c1a0a5d7d8c63dad4a6e4ca7d1d7209b959d0616a256b15e7a1659ce6c5bd0ef27758a85a69e1650b1328ecf3d028e13bc9ece1abea59cb4
7
+ data.tar.gz: fd498b8a49fb9112bf9214835062de8d28a5986ee58adeae8c39e5d9c8d26169348cfbf35a426a5bb93d5f30cdacc1b8bed57f551dc4a596a8fc1f8be20509a7
@@ -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
- # price: 99.99,
43
- # variants: [{
44
- # sku: '123',
45
- # attr: {
46
- # color: 'red',
47
- # size: 'L'
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:, price:, variants:)
52
- client.post('/products',
53
- body: {
54
- productID: id,
55
- productName: name,
56
- price: price,
57
- variants: variants
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
@@ -1,3 +1,3 @@
1
1
  module Cordial
2
- VERSION = '0.1.7'.freeze
2
+ VERSION = '0.1.8'.freeze
3
3
  end
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.7
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-27 00:00:00.000000000 Z
11
+ date: 2018-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty