waveapps 0.1.6 → 0.1.7
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/Gemfile.lock +1 -1
- data/examples/invoice.md +69 -5
- data/lib/waveapps/invoice.rb +22 -6
- data/lib/waveapps/ruby/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50dbb250a88d5bea155da73a27a5b0149c8684395b33ec6db4ee84e8c08fe6f3
|
4
|
+
data.tar.gz: 441d07ba0bd21da26e8987587ccf2f92ae456cfd30282bae25a7d47223d957da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 002eda0511d2f230cb6e564be7c7634952268e8b7a1f3049230806da86f6ee2a4f14f794d17227b92b2d6a6bdfbb48e2d94144b1cd1fa2cffd980b510f6eac6a
|
7
|
+
data.tar.gz: ed1d2f1290d6e4d043dbeed8bd8229d7f30370834ca8a6bcf235569c982217b509160f417d404f8375e6fca191a03047b6ffa9366f89bed15da11417195758d0
|
data/Gemfile.lock
CHANGED
data/examples/invoice.md
CHANGED
@@ -3,26 +3,91 @@
|
|
3
3
|
## Create invoice
|
4
4
|
|
5
5
|
```ruby
|
6
|
-
Waveapps::Invoice.create_invoice(
|
6
|
+
Waveapps::Invoice.create_invoice(
|
7
|
+
business_id: <BUSINESS_ID>,
|
8
|
+
customer_id: <CUSTOMER_ID>,
|
9
|
+
items: [
|
10
|
+
{
|
11
|
+
product_id: <PRODUCT_ID>
|
12
|
+
}
|
13
|
+
]
|
14
|
+
)
|
7
15
|
```
|
8
|
-
|
16
|
+
|
17
|
+
### Optional arguments
|
9
18
|
|
10
19
|
`status`, `currency`, `title`, `invoice_number`,
|
11
20
|
`po_number`, `invoice_date`, `exchange_rate`, `due_date`,
|
12
21
|
`memo`, `footer`, `disable_amex_payments`, `disable_credit_card_payments`,
|
13
22
|
`disable_bank_payments`, `item_title`, `unit_title`, `price_title`, `amount_title`, `hide_name`, `hide_description`, `hide_unit`, `hide_price`, `hide_amount`
|
14
23
|
|
24
|
+
The `items` argument takes a mandatory `product_id` value and `taxes`, `quantity`, `description`,
|
25
|
+
`unit_price`. The `description` and `unit_price` will override the values in the product.
|
26
|
+
|
27
|
+
The `taxes` object inside `items` takes a mandatory `sales_tax_id` and an optional `amount`.
|
28
|
+
|
29
|
+
The default `status` on creation is `DRAFT`. You can override this to `SAVED` when calling this method
|
30
|
+
|
31
|
+
### Example with taxes
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
Waveapps::Invoice.create_invoice(
|
35
|
+
business_id: <BUSINESS_ID>,
|
36
|
+
customer_id: <CUSTOMER_ID>,
|
37
|
+
items: [
|
38
|
+
{
|
39
|
+
product_id: <PRODUCT_ID>,
|
40
|
+
taxes: [
|
41
|
+
{
|
42
|
+
amount: 89.7,
|
43
|
+
sales_tax_id: <SALES_TAX_ID>
|
44
|
+
}
|
45
|
+
]
|
46
|
+
}
|
47
|
+
]
|
48
|
+
)
|
49
|
+
```
|
50
|
+
|
51
|
+
### Example with product override
|
52
|
+
|
53
|
+
```ruby
|
54
|
+
Waveapps::Invoice.create_invoice(
|
55
|
+
business_id: <BUSINESS_ID>,
|
56
|
+
customer_id: <CUSTOMER_ID>,
|
57
|
+
items: [
|
58
|
+
{
|
59
|
+
product_id: <PRODUCT_ID>,
|
60
|
+
description: "5 Watt C7 light bulb",
|
61
|
+
unit_price: "2.7",
|
62
|
+
quantity: 5
|
63
|
+
}
|
64
|
+
]
|
65
|
+
)
|
66
|
+
```
|
67
|
+
|
68
|
+
|
15
69
|
## List invoices
|
16
70
|
```ruby
|
17
71
|
Waveapps::Invoice.list_invoices(business_id: <BUSINESS_ID>)
|
18
72
|
```
|
19
73
|
|
74
|
+
### Optional arguments
|
75
|
+
|
76
|
+
`status`, `currency`, `title`, `invoice_number`,
|
77
|
+
`po_number`, `invoice_date`, `exchange_rate`, `due_date`,
|
78
|
+
`memo`, `footer`, `disable_amex_payments`, `disable_credit_card_payments`,
|
79
|
+
`disable_bank_payments`, `item_title`, `unit_title`, `price_title`, `amount_title`, `hide_name`, `hide_description`, `hide_unit`, `hide_price`, `hide_amount`
|
80
|
+
|
81
|
+
The default `page_size` is 10 and `page` is 1
|
82
|
+
Check the allowed `sort` arguments [here](https://developer.waveapps.com/hc/en-us/articles/360019968212#invoicesort). By default, the results are sorted by `[CREATED_AT_DESC]`.
|
83
|
+
|
84
|
+
|
20
85
|
## Send invoice
|
21
86
|
|
22
87
|
Provide email of recipients in the `to` argument. If you have more than one recipient, pass it as an array.
|
23
88
|
|
24
89
|
```ruby
|
25
|
-
Waveapps::Invoice.send_invoice(invoice_id: <INVOICE_ID>, to: [<EMAIL>])
|
90
|
+
Waveapps::Invoice.send_invoice(invoice_id: <INVOICE_ID>, to: [<EMAIL>, <EMAIL>])
|
26
91
|
```
|
27
92
|
|
28
93
|
Optional arguments
|
@@ -46,8 +111,7 @@ Waveapps::Invoice.delete_invoice(invoice_id: <INVOICE_ID>)
|
|
46
111
|
|
47
112
|
## Mark invoice as sent
|
48
113
|
|
49
|
-
Provide one of the
|
50
|
-
`EXPORT_PDF`, `GMAIL`, `MARKED_SENT`, `NOT_SENT`, `OUTLOOK`, `SHARED_LINK`, `SKIPPED`, `WAVE`, `YAHOO`
|
114
|
+
Provide a `send_method` from one of the allowed methods [here](https://developer.waveapps.com/hc/en-us/articles/360019968212#invoicesendmethod)
|
51
115
|
|
52
116
|
```ruby
|
53
117
|
Waveapps::Invoice.mark_as_sent(invoice_id: <INVOICE_ID>, send_method: <SEND_METHOD>)
|
data/lib/waveapps/invoice.rb
CHANGED
@@ -3,11 +3,19 @@
|
|
3
3
|
module Waveapps
|
4
4
|
class Invoice
|
5
5
|
ListInvoicesQuery = Waveapps::Api::Client.parse <<-'GRAPHQL'
|
6
|
-
query(
|
6
|
+
query(
|
7
|
+
$businessId: ID!, $page: Int!, $pageSize: Int!, $sort: [InvoiceSort!]!,
|
8
|
+
$status: InvoiceStatus, $customerId: ID, $currency: CurrencyCode,
|
9
|
+
$sourceId: ID, $invoiceDateStart: Date, $invoiceDateEnd: Date,
|
10
|
+
$modifiedAtAfter: DateTime, $modifiedAtBefore: DateTime) {
|
7
11
|
business(id: $businessId) {
|
8
12
|
id
|
9
13
|
isClassicInvoicing
|
10
|
-
invoices(page: $page, pageSize: $pageSize
|
14
|
+
invoices(page: $page, pageSize: $pageSize, sort: $sort,
|
15
|
+
status: $status, customerId: $customerId, currency: $currency,
|
16
|
+
sourceId: $sourceId, invoiceDateStart: $invoiceDateStart,
|
17
|
+
invoiceDateEnd: $invoiceDateEnd, modifiedAtAfter: $modifiedAtAfter,
|
18
|
+
modifiedAtBefore: $modifiedAtBefore) {
|
11
19
|
pageInfo {
|
12
20
|
currentPage
|
13
21
|
totalPages
|
@@ -124,14 +132,22 @@ module Waveapps
|
|
124
132
|
}
|
125
133
|
GRAPHQL
|
126
134
|
|
127
|
-
def self.list_invoices(page: 1, page_size: 10,
|
135
|
+
def self.list_invoices(page: 1, page_size: 10, sort: [ "CREATED_AT_DESC"],
|
136
|
+
status: nil, customer_id: nil, currency: nil, source_id: nil,
|
137
|
+
invoice_date_start: nil, invoice_date_end: nil, modified_at_after: nil,
|
138
|
+
modified_at_before: nil, business_id:
|
139
|
+
)
|
128
140
|
response = Waveapps::Api::Client.query(
|
129
141
|
ListInvoicesQuery, variables: {
|
130
|
-
businessId: business_id, page: page, pageSize: page_size
|
142
|
+
businessId: business_id, page: page, pageSize: page_size, sort: sort,
|
143
|
+
status: status, customerId: customer_id, currency: currency,
|
144
|
+
sourceId: source_id, invoiceDateStart: invoice_date_start,
|
145
|
+
invoiceDateEnd: invoice_date_end, modifiedAtAfter: modified_at_after,
|
146
|
+
modifiedAtBefore: modified_at_before
|
131
147
|
})
|
132
148
|
|
133
|
-
if response.data && response.data.business
|
134
|
-
return response.data.business.invoices
|
149
|
+
if response.data && response.data.business && response.data.business
|
150
|
+
return response.data.business.invoices
|
135
151
|
end
|
136
152
|
Waveapps::Api.handle_errors(response, :business)
|
137
153
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: waveapps
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hannah Masila
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-05-
|
11
|
+
date: 2020-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|