cordial 0.1.12 → 1.0.0

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: abc91b0ced583d2e4807f083d21c969f8c8047f12eeda2bd1a6c73a0cc493a63
4
- data.tar.gz: 72964cb60ef7cf3724cb25470b52f94aec62ca88b53489f4a7510533458c3399
3
+ metadata.gz: fc3770bdbc18b1976cc244a4029ce9b165aee66c1a4c5d71dd057788871ab2cf
4
+ data.tar.gz: a3c68b2700ba2d5f017234c5f83f38938e03a1700d85b6fc2ce84d709500dfbd
5
5
  SHA512:
6
- metadata.gz: 961e52a54f0bb6e78fe3006923284c457933d6c5c84953d898652b3fea614b02c33257dd557d09801065c1ed9383966b757e85434d774e583ba399c11c6d6264
7
- data.tar.gz: 8b8ca74ffa9e88e1561863c1514b93c1b782c5f2a810ec1b7c581e4a6f67bf522083434908da25df3f57bea7ecb2d119366d2103fa0d3446d5a4eb0caa932672
6
+ metadata.gz: 1a7839aed557e837f04bf412a2923131ae29a84b21679edba9e7e6ee501ab608e44949bd651d924b6e5d7f10e618deb52c2b7ee762a3220c9d622a00e19839b8
7
+ data.tar.gz: 4707b6dae09f3be12df850b14e970290c8537128a726ec1158d6e19716ccbc5ee49c052c7f1997d932adc8a842ab6ab0b0cb2753f0265c2715dffda2d02cbd42
data/History.md CHANGED
@@ -1,4 +1,11 @@
1
1
 
2
+ v1.0.0 / 2018-12-04
3
+ ==================
4
+
5
+ * First stable release!
6
+ * Update Yardoc for Products
7
+ * Update Yardoc for Cordial::Orders
8
+
2
9
  v0.1.12 / 2018-10-04
3
10
  ==================
4
11
 
@@ -1,5 +1,6 @@
1
1
  module Cordial
2
- # Wraps all interaction with the Order resource.
2
+ # Pragmatic wrapper around the orders REST Api.
3
+ #
3
4
  # @see https://api.cordial.io/docs/v1/#!/orders
4
5
  class Orders
5
6
  include ::HTTParty
@@ -8,52 +9,51 @@ module Cordial
8
9
  # Find an order
9
10
  # @example Usage
10
11
  # Cordial::Orders.find(id: 1)
11
- # @example Response when the order was found
12
- # {
13
- # "_id"=>"5b3a774a2cab4e1a59d0cc6d",
14
- # "orderID"=>"1",
15
- # "purchaseDate"=>"2015-01-10T01:47:43+0000",
16
- # "items"=>[
17
- # {
18
- # "productID"=>"1",
19
- # "sku"=>"123",
20
- # "name"=>"Test product",
21
- # "attr"=>{
22
- # "color"=>"blue",
23
- # "size"=>"L"
24
- # },
25
- # "amount"=>0
26
- # }
27
- # ],
28
- # "cID"=>"5aea409bbb3dc2f9bc27158f",
29
- # "totalAmount"=>0
30
- # }
31
12
  #
32
- # @example Response when the order was not found.
33
- # {"error"=>true, "message"=>"record not found"}
13
+ # @param id [String|Fixnum] The order's id.
14
+ #
15
+ # @return [Hash]
16
+ # @return [{"error"=>true, "message"=>"record not found"}]
34
17
  def self.find(id:)
35
18
  client.get("/orders/#{id}")
36
19
  end
37
20
 
38
21
  # Create a new order.
39
22
  #
40
- # This endpoint does not support the idea of an upsert like others do.
41
- # Subsequent calls will fail.
23
+ # @note This endpoint does not support upsert.
42
24
  #
43
25
  # @example Usage.
44
- # Cordial::Orders.create({...})
26
+ # Cordial::Orders.create({...})
45
27
  #
46
- # @example response when the orderID is not on cordial
47
- # {"success"=>true}
48
- #
49
- # @example Response when orderID already exist on cordial.
50
- # {"error"=>true, "messages"=>"ID must be unique"}
28
+ # @return [{"success"=>true}]
29
+ # @return [{"error"=>true, "messages"=>"ID must be unique"}]
51
30
  def self.create(options)
52
31
  order = Cordial::Order.new(options)
53
32
  client.post('/orders', body: order.to_json)
54
33
  end
55
34
 
56
- # List orders in Cordial
35
+ # List Orders matching criteria.
36
+ #
37
+ # @example
38
+ # Cordial::Orders.index(
39
+ # fields: 'orderID,purchaseDate',
40
+ # purchaseDate: { 'lt': '2018-10-21 11:11:11' },
41
+ # per_page: 5
42
+ # )
43
+ #
44
+ # @option options [String] :fields Comma delimited string of fields to be returned.
45
+ # @option options [String] :cID Where Customer ID is..
46
+ # @option options [String] :email Where email is..
47
+ # @option options [Hash] :purchaseDate When purchased on, before, and after (YYYY-MM-DD HH:ii:ss)
48
+ # {
49
+ # 'eq': '2018-10-31 11:59:59',
50
+ # 'lt': '2018-10-31 11:59:59',
51
+ # 'gt': '2018-10-31 11:59:59'
52
+ # }
53
+ # @option options [Fixnum] :page Which page of results
54
+ # @option options [Fixnum] :per_page How many results to return on a page (max: 10,000)
55
+ #
56
+ # @return [Array<Hash>]
57
57
  def self.index(options = {})
58
58
  client.get(
59
59
  '/orders',
@@ -1,41 +1,40 @@
1
1
  module Cordial
2
- # Wraps all interaction with the Product resource.
2
+ # Pragmatic wrapper around the products REST Api.
3
+ #
3
4
  # @see https://api.cordial.io/docs/v1/#!/products
4
5
  class Products
5
6
  include ::HTTParty
6
7
  extend Client
7
8
 
8
9
  # Find a product.
10
+ #
9
11
  # @example Usage
10
12
  # Cordial::Products.find(id: 1)
11
- # @example Response when the product was found.
12
- # {
13
- # "_id"=>"5b28275fe1dc0fa0c872abec",
14
- # "productID"=>"1",
15
- # "productName"=>"Test Product",
16
- # "price"=>10,
17
- # "variants"=>[
18
- # {
19
- # "sku"=>"123456789",
20
- # "attr"=>{"color"=>"blue", "size"=>"Large"},
21
- # "qty"=>"10"}
22
- # ],
23
- # "accountID"=>645,
24
- # "totalQty"=>10,
25
- # "lm"=>"2018-06-18T21:42:55+0000",
26
- # "ct"=>"2018-06-18T21:42:55+0000"
27
- # }
28
13
  #
29
- # @example Response when the product was not found.
30
- # {"error"=>true, "message"=>"record not found"}
14
+ # @return [Hash]
15
+ # @return [{"error"=>true, "message"=>"record not found"}]
31
16
  def self.find(id:)
32
17
  client.get("/products/#{id}")
33
18
  end
34
19
 
35
20
  # Create a new product.
36
- # options keyword argument is for optional parameters
37
- # https://support.cordial.com/hc/en-us/articles/203886098#postProducts
38
- # If the product already exists it will be updated.
21
+ #
22
+ # @note If the product already exists it will be updated.
23
+ #
24
+ # @see https://support.cordial.com/hc/en-us/articles/203886098#postProducts
25
+ #
26
+ # @param id [String|Fixnum]
27
+ # @param name [String]
28
+ #
29
+ # @option options [Float] :price
30
+ # @option options [Array<Hash>] :variants
31
+ # @option options [Boolean] :inStock
32
+ # @option options [Boolean] :taxable
33
+ # @option options [Boolean] :enabled
34
+ # @option options [Array] :tags
35
+ # @option options [String] :url
36
+ # @option options [Hash] :properties
37
+ #
39
38
  # @example Usage.
40
39
  # Cordial::Products.create(
41
40
  # id: 1,
@@ -1,3 +1,3 @@
1
1
  module Cordial
2
- VERSION = '0.1.12'.freeze
2
+ VERSION = '1.0.0'.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.12
4
+ version: 1.0.0
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-10-04 00:00:00.000000000 Z
11
+ date: 2018-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty