printavo-ruby 0.8.0 → 0.10.0
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/docs/CHANGELOG.md +34 -0
- data/docs/TODO.md +31 -31
- data/lib/printavo/client.rb +32 -0
- data/lib/printavo/models/category.rb +9 -0
- data/lib/printavo/models/merch_order.rb +15 -0
- data/lib/printavo/models/merch_store.rb +11 -0
- data/lib/printavo/models/payment.rb +11 -0
- data/lib/printavo/models/payment_request.rb +12 -0
- data/lib/printavo/models/payment_term.rb +10 -0
- data/lib/printavo/models/pricing_matrix.rb +9 -0
- data/lib/printavo/models/product.rb +11 -0
- data/lib/printavo/resources/categories.rb +33 -0
- data/lib/printavo/resources/merch_orders.rb +33 -0
- data/lib/printavo/resources/merch_stores.rb +33 -0
- data/lib/printavo/resources/payment_requests.rb +48 -0
- data/lib/printavo/resources/payment_terms.rb +51 -0
- data/lib/printavo/resources/payments.rb +36 -0
- data/lib/printavo/resources/pricing_matrices.rb +33 -0
- data/lib/printavo/resources/products.rb +33 -0
- data/lib/printavo/version.rb +1 -1
- data/lib/printavo.rb +26 -10
- metadata +17 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5c7c947ef3f0582fd5c30b1aa44f69cfdc2ba135ac4b5b616db3fc5c63615322
|
|
4
|
+
data.tar.gz: 664d2cafd355a83630af29c9902cf89dc2af838694cb91cc6ba182603d115a92
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7e321c541a352c6ae3983682c03406ca80725499d2014bcfcc6cda1f8f2a8654f4aba9dc25452c7da7225a993ef205f0d698b23f5dfd68396b0f6add13070f27
|
|
7
|
+
data.tar.gz: 3182ba400910bc9de615ce19944bbac0b027b80874e35a364e2c64c476d383e86bbed46b501cd0d602dd06c49aa3a20b242f7d510261c734c56649301475e301
|
data/docs/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,40 @@ All notable changes to this project will be documented in this file.
|
|
|
6
6
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
7
7
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
8
8
|
|
|
9
|
+
## [0.10.0] - 2026-03-31
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- `Printavo::Payment` model (`id`, `amount`, `payment_method`, `paid_at`)
|
|
13
|
+
- `Payments` resource: `all(order_id:)`, `find(id)` — read-only, scoped to an order
|
|
14
|
+
- `Printavo::PaymentRequest` model (`id`, `amount`, `sent_at`, `paid_at`, `details`)
|
|
15
|
+
- `PaymentRequests` resource: `all(order_id:)`, `find(id)`, `create(**input)`, `delete(id)` —
|
|
16
|
+
`paymentRequestCreate` / `paymentRequestDelete` mutations
|
|
17
|
+
- `Printavo::PaymentTerm` model (`id`, `name`, `net_days`)
|
|
18
|
+
- `PaymentTerms` resource: `all`, `find(id)`, `create(**input)`, `update(id, **input)`,
|
|
19
|
+
`archive(id)` — `paymentTermCreate` / `paymentTermUpdate` / `paymentTermArchive` mutations;
|
|
20
|
+
`archive` returns `nil` (same convention as `delete`)
|
|
21
|
+
- `client.payments`, `client.payment_requests`, `client.payment_terms` entry points
|
|
22
|
+
on `Printavo::Client`
|
|
23
|
+
- 11 new `.graphql` files under `lib/printavo/graphql/`
|
|
24
|
+
|
|
25
|
+
## [0.9.0] - 2026-03-31
|
|
26
|
+
|
|
27
|
+
### Added
|
|
28
|
+
- `Printavo::MerchStore` model (`id`, `name`, `url`, `summary`)
|
|
29
|
+
- `MerchStores` resource: `all`, `find(id)`
|
|
30
|
+
- `Printavo::MerchOrder` model (`id`, `status`, `delivery`, `contact` — returns `Printavo::Contact`)
|
|
31
|
+
- `MerchOrders` resource: `all`, `find(id)`
|
|
32
|
+
- `Printavo::Product` model (`id`, `name`, `sku`, `description`)
|
|
33
|
+
- `Products` resource: `all`, `find(id)`
|
|
34
|
+
- `Printavo::PricingMatrix` model (`id`, `name`)
|
|
35
|
+
- `PricingMatrices` resource: `all`, `find(id)`
|
|
36
|
+
- `Printavo::Category` model (`id`, `name`)
|
|
37
|
+
- `Categories` resource: `all`, `find(id)`
|
|
38
|
+
- `client.categories`, `client.merch_orders`, `client.merch_stores`, `client.pricing_matrices`,
|
|
39
|
+
`client.products` entry points on `Printavo::Client`
|
|
40
|
+
- 10 new `.graphql` files under `lib/printavo/graphql/`
|
|
41
|
+
- 2 new factory files: `spec/support/factories/merch.rb`, `spec/support/factories/product.rb`
|
|
42
|
+
|
|
9
43
|
## [0.8.0] - 2026-03-31
|
|
10
44
|
|
|
11
45
|
### Added
|
data/docs/TODO.md
CHANGED
|
@@ -156,10 +156,10 @@ return values — they are exposed via model field accessors, not separate resou
|
|
|
156
156
|
- [ ] `approvalRequestRevoke(id:)` mutation
|
|
157
157
|
- [ ] `approvalRequestUnapprove(id:)` mutation
|
|
158
158
|
|
|
159
|
-
### Categories
|
|
159
|
+
### Categories ✅
|
|
160
160
|
|
|
161
|
-
- [
|
|
162
|
-
- [
|
|
161
|
+
- [x] `Printavo::Category` model (`id`, `name`)
|
|
162
|
+
- [x] `Categories` resource: `all`, `find(id)` — reference data for products/line items
|
|
163
163
|
|
|
164
164
|
### Contractor Profiles
|
|
165
165
|
|
|
@@ -225,13 +225,13 @@ return values — they are exposed via model field accessors, not separate resou
|
|
|
225
225
|
- [x] `lineItemGroupUpdate` / `lineItemGroupUpdates` (bulk) mutations
|
|
226
226
|
- [x] `lineItemGroupDelete` / `lineItemGroupDeletes` (bulk) mutations
|
|
227
227
|
|
|
228
|
-
### Merch
|
|
228
|
+
### Merch ✅
|
|
229
229
|
|
|
230
|
-
- [
|
|
231
|
-
- [
|
|
232
|
-
- [
|
|
233
|
-
- [
|
|
234
|
-
- [
|
|
230
|
+
- [x] `Printavo::MerchStore` model (`id`, `name`, `url`, `summary`)
|
|
231
|
+
- [x] `Printavo::MerchOrder` model (`id`, `status`, `delivery`, `contact`)
|
|
232
|
+
- [x] `MerchStores` resource: `all`, `find(id)`
|
|
233
|
+
- [x] `MerchOrders` resource: `all`, `find(id)`
|
|
234
|
+
- [x] `client.merch_stores` / `client.merch_orders` entry points
|
|
235
235
|
|
|
236
236
|
### Mockups & Production Files
|
|
237
237
|
|
|
@@ -243,16 +243,16 @@ return values — they are exposed via model field accessors, not separate resou
|
|
|
243
243
|
- [ ] `productionFileCreate` / `productionFileCreates` (bulk) mutations
|
|
244
244
|
- [ ] `productionFileDelete` / `productionFileDeletes` (bulk) mutations
|
|
245
245
|
|
|
246
|
-
### Payments
|
|
246
|
+
### Payments ✅
|
|
247
247
|
|
|
248
|
-
- [
|
|
249
|
-
- [
|
|
250
|
-
- [
|
|
251
|
-
- [
|
|
252
|
-
- [
|
|
253
|
-
- [
|
|
254
|
-
- [
|
|
255
|
-
- [
|
|
248
|
+
- [x] `Printavo::Payment` model (`id`, `amount`, `payment_method`, `paid_at`)
|
|
249
|
+
- [x] `Printavo::PaymentRequest` model (`id`, `amount`, `sent_at`, `paid_at`, `details`)
|
|
250
|
+
- [x] `Printavo::PaymentTerm` model (`id`, `name`, `net_days`)
|
|
251
|
+
- [x] `Payments` resource: `all(order_id:)`, `find(id)`
|
|
252
|
+
- [x] `PaymentRequests` resource: `all(order_id:)`, `find(id)`, `create`, `delete`
|
|
253
|
+
- [x] `paymentRequestCreate`, `paymentRequestDelete` mutations
|
|
254
|
+
- [x] `PaymentTerms` resource: `all`, `find(id)`, `create`, `update`, `archive`
|
|
255
|
+
- [x] `paymentTermCreate`, `paymentTermUpdate`, `paymentTermArchive` mutations
|
|
256
256
|
|
|
257
257
|
### Preset Tasks
|
|
258
258
|
|
|
@@ -264,12 +264,12 @@ return values — they are exposed via model field accessors, not separate resou
|
|
|
264
264
|
- [ ] `presetTaskGroupCreate`, `presetTaskGroupUpdate`, `presetTaskGroupDelete` mutations
|
|
265
265
|
- [ ] `presetTaskGroupApply(id:, order_id:)` mutation — applies a group to an order
|
|
266
266
|
|
|
267
|
-
### Product Catalog & Pricing
|
|
267
|
+
### Product Catalog & Pricing ✅
|
|
268
268
|
|
|
269
|
-
- [
|
|
270
|
-
- [
|
|
271
|
-
- [
|
|
272
|
-
- [
|
|
269
|
+
- [x] `Printavo::Product` model (`id`, `name`, `sku`, `description`)
|
|
270
|
+
- [x] `Printavo::PricingMatrix` model (`id`, `name`)
|
|
271
|
+
- [x] `Products` resource: `all`, `find(id)`
|
|
272
|
+
- [x] `PricingMatrices` resource: `all`, `find(id)`
|
|
273
273
|
|
|
274
274
|
### Tasks ✅
|
|
275
275
|
|
|
@@ -331,17 +331,17 @@ return values — they are exposed via model field accessors, not separate resou
|
|
|
331
331
|
- [x] `Fees` resource (`all`, `find`, `create`/`creates`, `update`/`updates`, `delete`/`deletes`)
|
|
332
332
|
- [x] `Expenses` resource (`all`, `find`, `create`, `update`)
|
|
333
333
|
|
|
334
|
-
### v0.9.0 — Merch, Products & Pricing
|
|
334
|
+
### v0.9.0 — Merch, Products & Pricing ✅
|
|
335
335
|
|
|
336
|
-
- [
|
|
337
|
-
- [
|
|
338
|
-
- [
|
|
336
|
+
- [x] `MerchStores` + `MerchOrders` resources
|
|
337
|
+
- [x] `Products` resource + `PricingMatrices` resource
|
|
338
|
+
- [x] `Categories` resource (reference data)
|
|
339
339
|
|
|
340
|
-
### v0.10.0 — Financial: Payments, Payment Terms & Requests
|
|
340
|
+
### v0.10.0 — Financial: Payments, Payment Terms & Requests ✅
|
|
341
341
|
|
|
342
|
-
- [
|
|
343
|
-
- [
|
|
344
|
-
- [
|
|
342
|
+
- [x] `Payments` resource (`all`, `find`)
|
|
343
|
+
- [x] `PaymentRequests` resource (`all`, `find`, `create`, `delete`)
|
|
344
|
+
- [x] `PaymentTerms` resource (`all`, `find`, `create`, `update`, `archive`)
|
|
345
345
|
|
|
346
346
|
### v0.11.0 — Workflow: Approvals & Preset Tasks
|
|
347
347
|
|
data/lib/printavo/client.rb
CHANGED
|
@@ -29,6 +29,10 @@ module Printavo
|
|
|
29
29
|
Resources::Account.new(@graphql)
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
+
def categories
|
|
33
|
+
Resources::Categories.new(@graphql)
|
|
34
|
+
end
|
|
35
|
+
|
|
32
36
|
def contacts
|
|
33
37
|
Resources::Contacts.new(@graphql)
|
|
34
38
|
end
|
|
@@ -81,10 +85,38 @@ module Printavo
|
|
|
81
85
|
'Simply discard the client instance when done.'
|
|
82
86
|
end
|
|
83
87
|
|
|
88
|
+
def merch_orders
|
|
89
|
+
Resources::MerchOrders.new(@graphql)
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def merch_stores
|
|
93
|
+
Resources::MerchStores.new(@graphql)
|
|
94
|
+
end
|
|
95
|
+
|
|
84
96
|
def orders
|
|
85
97
|
Resources::Orders.new(@graphql)
|
|
86
98
|
end
|
|
87
99
|
|
|
100
|
+
def payment_requests
|
|
101
|
+
Resources::PaymentRequests.new(@graphql)
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
def payment_terms
|
|
105
|
+
Resources::PaymentTerms.new(@graphql)
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def payments
|
|
109
|
+
Resources::Payments.new(@graphql)
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def pricing_matrices
|
|
113
|
+
Resources::PricingMatrices.new(@graphql)
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
def products
|
|
117
|
+
Resources::Products.new(@graphql)
|
|
118
|
+
end
|
|
119
|
+
|
|
88
120
|
def statuses
|
|
89
121
|
Resources::Statuses.new(@graphql)
|
|
90
122
|
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# lib/printavo/models/merch_order.rb
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
module Printavo
|
|
5
|
+
class MerchOrder < Models::Base
|
|
6
|
+
def id = self['id']
|
|
7
|
+
def status = self['status']
|
|
8
|
+
def delivery = self['delivery']
|
|
9
|
+
|
|
10
|
+
def contact
|
|
11
|
+
attrs = self['contact']
|
|
12
|
+
Contact.new(attrs) if attrs
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# lib/printavo/models/payment_request.rb
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
module Printavo
|
|
5
|
+
class PaymentRequest < Models::Base
|
|
6
|
+
def id = self['id']
|
|
7
|
+
def amount = self['amount']
|
|
8
|
+
def sent_at = self['sentAt']
|
|
9
|
+
def paid_at = self['paidAt']
|
|
10
|
+
def details = self['details']
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# lib/printavo/resources/categories.rb
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
module Printavo
|
|
5
|
+
module Resources
|
|
6
|
+
class Categories < Base
|
|
7
|
+
ALL_QUERY = File.read(File.join(__dir__, '../graphql/categories/all.graphql')).freeze
|
|
8
|
+
FIND_QUERY = File.read(File.join(__dir__, '../graphql/categories/find.graphql')).freeze
|
|
9
|
+
|
|
10
|
+
def all(first: 25, after: nil)
|
|
11
|
+
fetch_page(first: first, after: after).records
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def find(id)
|
|
15
|
+
data = @graphql.query(FIND_QUERY, variables: { id: id.to_s })
|
|
16
|
+
Printavo::Category.new(data['category'])
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
private
|
|
20
|
+
|
|
21
|
+
def fetch_page(first: 25, after: nil, **)
|
|
22
|
+
data = @graphql.query(ALL_QUERY, variables: { first: first, after: after })
|
|
23
|
+
nodes = data['categories']['nodes'].map { |attrs| Printavo::Category.new(attrs) }
|
|
24
|
+
page_info = data['categories']['pageInfo']
|
|
25
|
+
Printavo::Page.new(
|
|
26
|
+
records: nodes,
|
|
27
|
+
has_next_page: page_info['hasNextPage'],
|
|
28
|
+
end_cursor: page_info['endCursor']
|
|
29
|
+
)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# lib/printavo/resources/merch_orders.rb
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
module Printavo
|
|
5
|
+
module Resources
|
|
6
|
+
class MerchOrders < Base
|
|
7
|
+
ALL_QUERY = File.read(File.join(__dir__, '../graphql/merch_orders/all.graphql')).freeze
|
|
8
|
+
FIND_QUERY = File.read(File.join(__dir__, '../graphql/merch_orders/find.graphql')).freeze
|
|
9
|
+
|
|
10
|
+
def all(first: 25, after: nil)
|
|
11
|
+
fetch_page(first: first, after: after).records
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def find(id)
|
|
15
|
+
data = @graphql.query(FIND_QUERY, variables: { id: id.to_s })
|
|
16
|
+
Printavo::MerchOrder.new(data['merchOrder'])
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
private
|
|
20
|
+
|
|
21
|
+
def fetch_page(first: 25, after: nil, **)
|
|
22
|
+
data = @graphql.query(ALL_QUERY, variables: { first: first, after: after })
|
|
23
|
+
nodes = data['merchOrders']['nodes'].map { |attrs| Printavo::MerchOrder.new(attrs) }
|
|
24
|
+
page_info = data['merchOrders']['pageInfo']
|
|
25
|
+
Printavo::Page.new(
|
|
26
|
+
records: nodes,
|
|
27
|
+
has_next_page: page_info['hasNextPage'],
|
|
28
|
+
end_cursor: page_info['endCursor']
|
|
29
|
+
)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# lib/printavo/resources/merch_stores.rb
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
module Printavo
|
|
5
|
+
module Resources
|
|
6
|
+
class MerchStores < Base
|
|
7
|
+
ALL_QUERY = File.read(File.join(__dir__, '../graphql/merch_stores/all.graphql')).freeze
|
|
8
|
+
FIND_QUERY = File.read(File.join(__dir__, '../graphql/merch_stores/find.graphql')).freeze
|
|
9
|
+
|
|
10
|
+
def all(first: 25, after: nil)
|
|
11
|
+
fetch_page(first: first, after: after).records
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def find(id)
|
|
15
|
+
data = @graphql.query(FIND_QUERY, variables: { id: id.to_s })
|
|
16
|
+
Printavo::MerchStore.new(data['merchStore'])
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
private
|
|
20
|
+
|
|
21
|
+
def fetch_page(first: 25, after: nil, **)
|
|
22
|
+
data = @graphql.query(ALL_QUERY, variables: { first: first, after: after })
|
|
23
|
+
nodes = data['merchStores']['nodes'].map { |attrs| Printavo::MerchStore.new(attrs) }
|
|
24
|
+
page_info = data['merchStores']['pageInfo']
|
|
25
|
+
Printavo::Page.new(
|
|
26
|
+
records: nodes,
|
|
27
|
+
has_next_page: page_info['hasNextPage'],
|
|
28
|
+
end_cursor: page_info['endCursor']
|
|
29
|
+
)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# lib/printavo/resources/payment_requests.rb
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
module Printavo
|
|
5
|
+
module Resources
|
|
6
|
+
class PaymentRequests < Base
|
|
7
|
+
ALL_QUERY = File.read(File.join(__dir__, '../graphql/payment_requests/all.graphql')).freeze
|
|
8
|
+
FIND_QUERY = File.read(File.join(__dir__, '../graphql/payment_requests/find.graphql')).freeze
|
|
9
|
+
CREATE_MUTATION = File.read(File.join(__dir__, '../graphql/payment_requests/create.graphql')).freeze
|
|
10
|
+
DELETE_MUTATION = File.read(File.join(__dir__, '../graphql/payment_requests/delete.graphql')).freeze
|
|
11
|
+
|
|
12
|
+
def all(order_id:, first: 25, after: nil)
|
|
13
|
+
fetch_page(order_id: order_id, first: first, after: after).records
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def find(id)
|
|
17
|
+
data = @graphql.query(FIND_QUERY, variables: { id: id.to_s })
|
|
18
|
+
Printavo::PaymentRequest.new(data['paymentRequest'])
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def create(**input)
|
|
22
|
+
data = @graphql.mutate(CREATE_MUTATION, variables: { input: camelize_keys(input) })
|
|
23
|
+
Printavo::PaymentRequest.new(data['paymentRequestCreate'])
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def delete(id)
|
|
27
|
+
@graphql.mutate(DELETE_MUTATION, variables: { id: id.to_s })
|
|
28
|
+
nil
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
private
|
|
32
|
+
|
|
33
|
+
def fetch_page(order_id:, first: 25, after: nil, **)
|
|
34
|
+
data = @graphql.query(
|
|
35
|
+
ALL_QUERY,
|
|
36
|
+
variables: { orderId: order_id.to_s, first: first, after: after }
|
|
37
|
+
)
|
|
38
|
+
nodes = data['order']['paymentRequests']['nodes'].map { |attrs| Printavo::PaymentRequest.new(attrs) }
|
|
39
|
+
page_info = data['order']['paymentRequests']['pageInfo']
|
|
40
|
+
Printavo::Page.new(
|
|
41
|
+
records: nodes,
|
|
42
|
+
has_next_page: page_info['hasNextPage'],
|
|
43
|
+
end_cursor: page_info['endCursor']
|
|
44
|
+
)
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# lib/printavo/resources/payment_terms.rb
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
module Printavo
|
|
5
|
+
module Resources
|
|
6
|
+
class PaymentTerms < Base
|
|
7
|
+
ALL_QUERY = File.read(File.join(__dir__, '../graphql/payment_terms/all.graphql')).freeze
|
|
8
|
+
FIND_QUERY = File.read(File.join(__dir__, '../graphql/payment_terms/find.graphql')).freeze
|
|
9
|
+
CREATE_MUTATION = File.read(File.join(__dir__, '../graphql/payment_terms/create.graphql')).freeze
|
|
10
|
+
UPDATE_MUTATION = File.read(File.join(__dir__, '../graphql/payment_terms/update.graphql')).freeze
|
|
11
|
+
ARCHIVE_MUTATION = File.read(File.join(__dir__, '../graphql/payment_terms/archive.graphql')).freeze
|
|
12
|
+
|
|
13
|
+
def all(first: 25, after: nil)
|
|
14
|
+
fetch_page(first: first, after: after).records
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def find(id)
|
|
18
|
+
data = @graphql.query(FIND_QUERY, variables: { id: id.to_s })
|
|
19
|
+
Printavo::PaymentTerm.new(data['paymentTerm'])
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def create(**input)
|
|
23
|
+
data = @graphql.mutate(CREATE_MUTATION, variables: { input: camelize_keys(input) })
|
|
24
|
+
Printavo::PaymentTerm.new(data['paymentTermCreate'])
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def update(id, **input)
|
|
28
|
+
data = @graphql.mutate(UPDATE_MUTATION, variables: { id: id.to_s, input: camelize_keys(input) })
|
|
29
|
+
Printavo::PaymentTerm.new(data['paymentTermUpdate'])
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def archive(id)
|
|
33
|
+
@graphql.mutate(ARCHIVE_MUTATION, variables: { id: id.to_s })
|
|
34
|
+
nil
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
private
|
|
38
|
+
|
|
39
|
+
def fetch_page(first: 25, after: nil, **)
|
|
40
|
+
data = @graphql.query(ALL_QUERY, variables: { first: first, after: after })
|
|
41
|
+
nodes = data['paymentTerms']['nodes'].map { |attrs| Printavo::PaymentTerm.new(attrs) }
|
|
42
|
+
page_info = data['paymentTerms']['pageInfo']
|
|
43
|
+
Printavo::Page.new(
|
|
44
|
+
records: nodes,
|
|
45
|
+
has_next_page: page_info['hasNextPage'],
|
|
46
|
+
end_cursor: page_info['endCursor']
|
|
47
|
+
)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# lib/printavo/resources/payments.rb
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
module Printavo
|
|
5
|
+
module Resources
|
|
6
|
+
class Payments < Base
|
|
7
|
+
ALL_QUERY = File.read(File.join(__dir__, '../graphql/payments/all.graphql')).freeze
|
|
8
|
+
FIND_QUERY = File.read(File.join(__dir__, '../graphql/payments/find.graphql')).freeze
|
|
9
|
+
|
|
10
|
+
def all(order_id:, first: 25, after: nil)
|
|
11
|
+
fetch_page(order_id: order_id, first: first, after: after).records
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def find(id)
|
|
15
|
+
data = @graphql.query(FIND_QUERY, variables: { id: id.to_s })
|
|
16
|
+
Printavo::Payment.new(data['payment'])
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
private
|
|
20
|
+
|
|
21
|
+
def fetch_page(order_id:, first: 25, after: nil, **)
|
|
22
|
+
data = @graphql.query(
|
|
23
|
+
ALL_QUERY,
|
|
24
|
+
variables: { orderId: order_id.to_s, first: first, after: after }
|
|
25
|
+
)
|
|
26
|
+
nodes = data['order']['payments']['nodes'].map { |attrs| Printavo::Payment.new(attrs) }
|
|
27
|
+
page_info = data['order']['payments']['pageInfo']
|
|
28
|
+
Printavo::Page.new(
|
|
29
|
+
records: nodes,
|
|
30
|
+
has_next_page: page_info['hasNextPage'],
|
|
31
|
+
end_cursor: page_info['endCursor']
|
|
32
|
+
)
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# lib/printavo/resources/pricing_matrices.rb
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
module Printavo
|
|
5
|
+
module Resources
|
|
6
|
+
class PricingMatrices < Base
|
|
7
|
+
ALL_QUERY = File.read(File.join(__dir__, '../graphql/pricing_matrices/all.graphql')).freeze
|
|
8
|
+
FIND_QUERY = File.read(File.join(__dir__, '../graphql/pricing_matrices/find.graphql')).freeze
|
|
9
|
+
|
|
10
|
+
def all(first: 25, after: nil)
|
|
11
|
+
fetch_page(first: first, after: after).records
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def find(id)
|
|
15
|
+
data = @graphql.query(FIND_QUERY, variables: { id: id.to_s })
|
|
16
|
+
Printavo::PricingMatrix.new(data['pricingMatrix'])
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
private
|
|
20
|
+
|
|
21
|
+
def fetch_page(first: 25, after: nil, **)
|
|
22
|
+
data = @graphql.query(ALL_QUERY, variables: { first: first, after: after })
|
|
23
|
+
nodes = data['pricingMatrices']['nodes'].map { |attrs| Printavo::PricingMatrix.new(attrs) }
|
|
24
|
+
page_info = data['pricingMatrices']['pageInfo']
|
|
25
|
+
Printavo::Page.new(
|
|
26
|
+
records: nodes,
|
|
27
|
+
has_next_page: page_info['hasNextPage'],
|
|
28
|
+
end_cursor: page_info['endCursor']
|
|
29
|
+
)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# lib/printavo/resources/products.rb
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
module Printavo
|
|
5
|
+
module Resources
|
|
6
|
+
class Products < Base
|
|
7
|
+
ALL_QUERY = File.read(File.join(__dir__, '../graphql/products/all.graphql')).freeze
|
|
8
|
+
FIND_QUERY = File.read(File.join(__dir__, '../graphql/products/find.graphql')).freeze
|
|
9
|
+
|
|
10
|
+
def all(first: 25, after: nil)
|
|
11
|
+
fetch_page(first: first, after: after).records
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def find(id)
|
|
15
|
+
data = @graphql.query(FIND_QUERY, variables: { id: id.to_s })
|
|
16
|
+
Printavo::Product.new(data['product'])
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
private
|
|
20
|
+
|
|
21
|
+
def fetch_page(first: 25, after: nil, **)
|
|
22
|
+
data = @graphql.query(ALL_QUERY, variables: { first: first, after: after })
|
|
23
|
+
nodes = data['products']['nodes'].map { |attrs| Printavo::Product.new(attrs) }
|
|
24
|
+
page_info = data['products']['pageInfo']
|
|
25
|
+
Printavo::Page.new(
|
|
26
|
+
records: nodes,
|
|
27
|
+
has_next_page: page_info['hasNextPage'],
|
|
28
|
+
end_cursor: page_info['endCursor']
|
|
29
|
+
)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
data/lib/printavo/version.rb
CHANGED
data/lib/printavo.rb
CHANGED
|
@@ -6,47 +6,63 @@ require 'faraday/retry'
|
|
|
6
6
|
require 'json'
|
|
7
7
|
|
|
8
8
|
require_relative 'printavo/version'
|
|
9
|
-
require_relative 'printavo/errors'
|
|
10
9
|
require_relative 'printavo/config'
|
|
11
10
|
require_relative 'printavo/connection'
|
|
11
|
+
require_relative 'printavo/errors'
|
|
12
12
|
require_relative 'printavo/graphql_client'
|
|
13
13
|
require_relative 'printavo/page'
|
|
14
14
|
require_relative 'printavo/models/base'
|
|
15
15
|
require_relative 'printavo/models/account'
|
|
16
|
+
require_relative 'printavo/models/category'
|
|
16
17
|
require_relative 'printavo/models/contact'
|
|
17
18
|
require_relative 'printavo/models/customer'
|
|
18
|
-
require_relative 'printavo/models/invoice'
|
|
19
|
-
require_relative 'printavo/models/status'
|
|
20
|
-
require_relative 'printavo/models/order'
|
|
21
|
-
require_relative 'printavo/models/job'
|
|
22
19
|
require_relative 'printavo/models/expense'
|
|
23
20
|
require_relative 'printavo/models/fee'
|
|
24
21
|
require_relative 'printavo/models/imprint'
|
|
25
22
|
require_relative 'printavo/models/inquiry'
|
|
23
|
+
require_relative 'printavo/models/invoice'
|
|
24
|
+
require_relative 'printavo/models/job'
|
|
26
25
|
require_relative 'printavo/models/line_item'
|
|
27
26
|
require_relative 'printavo/models/line_item_group'
|
|
27
|
+
require_relative 'printavo/models/merch_order'
|
|
28
|
+
require_relative 'printavo/models/merch_store'
|
|
29
|
+
require_relative 'printavo/models/order'
|
|
30
|
+
require_relative 'printavo/models/payment'
|
|
31
|
+
require_relative 'printavo/models/payment_request'
|
|
32
|
+
require_relative 'printavo/models/payment_term'
|
|
33
|
+
require_relative 'printavo/models/pricing_matrix'
|
|
34
|
+
require_relative 'printavo/models/product'
|
|
35
|
+
require_relative 'printavo/models/status'
|
|
28
36
|
require_relative 'printavo/models/task'
|
|
29
37
|
require_relative 'printavo/models/thread'
|
|
30
38
|
require_relative 'printavo/models/transaction'
|
|
31
39
|
require_relative 'printavo/models/transaction_payment'
|
|
32
40
|
require_relative 'printavo/resources/base'
|
|
33
41
|
require_relative 'printavo/resources/account'
|
|
42
|
+
require_relative 'printavo/resources/categories'
|
|
34
43
|
require_relative 'printavo/resources/contacts'
|
|
35
44
|
require_relative 'printavo/resources/customers'
|
|
36
|
-
require_relative 'printavo/resources/invoices'
|
|
37
|
-
require_relative 'printavo/resources/statuses'
|
|
38
|
-
require_relative 'printavo/resources/orders'
|
|
39
|
-
require_relative 'printavo/resources/jobs'
|
|
40
45
|
require_relative 'printavo/resources/expenses'
|
|
41
46
|
require_relative 'printavo/resources/fees'
|
|
42
47
|
require_relative 'printavo/resources/imprints'
|
|
43
48
|
require_relative 'printavo/resources/inquiries'
|
|
49
|
+
require_relative 'printavo/resources/invoices'
|
|
50
|
+
require_relative 'printavo/resources/jobs'
|
|
44
51
|
require_relative 'printavo/resources/line_item_groups'
|
|
45
52
|
require_relative 'printavo/resources/line_items'
|
|
53
|
+
require_relative 'printavo/resources/merch_orders'
|
|
54
|
+
require_relative 'printavo/resources/merch_stores'
|
|
55
|
+
require_relative 'printavo/resources/orders'
|
|
56
|
+
require_relative 'printavo/resources/payment_requests'
|
|
57
|
+
require_relative 'printavo/resources/payment_terms'
|
|
58
|
+
require_relative 'printavo/resources/payments'
|
|
59
|
+
require_relative 'printavo/resources/pricing_matrices'
|
|
60
|
+
require_relative 'printavo/resources/products'
|
|
61
|
+
require_relative 'printavo/resources/statuses'
|
|
46
62
|
require_relative 'printavo/resources/tasks'
|
|
47
63
|
require_relative 'printavo/resources/threads'
|
|
48
|
-
require_relative 'printavo/resources/transactions'
|
|
49
64
|
require_relative 'printavo/resources/transaction_payments'
|
|
65
|
+
require_relative 'printavo/resources/transactions'
|
|
50
66
|
require_relative 'printavo/webhooks'
|
|
51
67
|
require_relative 'printavo/client'
|
|
52
68
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: printavo-ruby
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.10.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Stan Carver II
|
|
@@ -274,6 +274,7 @@ files:
|
|
|
274
274
|
- lib/printavo/graphql_client.rb
|
|
275
275
|
- lib/printavo/models/account.rb
|
|
276
276
|
- lib/printavo/models/base.rb
|
|
277
|
+
- lib/printavo/models/category.rb
|
|
277
278
|
- lib/printavo/models/contact.rb
|
|
278
279
|
- lib/printavo/models/customer.rb
|
|
279
280
|
- lib/printavo/models/expense.rb
|
|
@@ -284,7 +285,14 @@ files:
|
|
|
284
285
|
- lib/printavo/models/job.rb
|
|
285
286
|
- lib/printavo/models/line_item.rb
|
|
286
287
|
- lib/printavo/models/line_item_group.rb
|
|
288
|
+
- lib/printavo/models/merch_order.rb
|
|
289
|
+
- lib/printavo/models/merch_store.rb
|
|
287
290
|
- lib/printavo/models/order.rb
|
|
291
|
+
- lib/printavo/models/payment.rb
|
|
292
|
+
- lib/printavo/models/payment_request.rb
|
|
293
|
+
- lib/printavo/models/payment_term.rb
|
|
294
|
+
- lib/printavo/models/pricing_matrix.rb
|
|
295
|
+
- lib/printavo/models/product.rb
|
|
288
296
|
- lib/printavo/models/status.rb
|
|
289
297
|
- lib/printavo/models/task.rb
|
|
290
298
|
- lib/printavo/models/thread.rb
|
|
@@ -293,6 +301,7 @@ files:
|
|
|
293
301
|
- lib/printavo/page.rb
|
|
294
302
|
- lib/printavo/resources/account.rb
|
|
295
303
|
- lib/printavo/resources/base.rb
|
|
304
|
+
- lib/printavo/resources/categories.rb
|
|
296
305
|
- lib/printavo/resources/contacts.rb
|
|
297
306
|
- lib/printavo/resources/customers.rb
|
|
298
307
|
- lib/printavo/resources/expenses.rb
|
|
@@ -303,7 +312,14 @@ files:
|
|
|
303
312
|
- lib/printavo/resources/jobs.rb
|
|
304
313
|
- lib/printavo/resources/line_item_groups.rb
|
|
305
314
|
- lib/printavo/resources/line_items.rb
|
|
315
|
+
- lib/printavo/resources/merch_orders.rb
|
|
316
|
+
- lib/printavo/resources/merch_stores.rb
|
|
306
317
|
- lib/printavo/resources/orders.rb
|
|
318
|
+
- lib/printavo/resources/payment_requests.rb
|
|
319
|
+
- lib/printavo/resources/payment_terms.rb
|
|
320
|
+
- lib/printavo/resources/payments.rb
|
|
321
|
+
- lib/printavo/resources/pricing_matrices.rb
|
|
322
|
+
- lib/printavo/resources/products.rb
|
|
307
323
|
- lib/printavo/resources/statuses.rb
|
|
308
324
|
- lib/printavo/resources/tasks.rb
|
|
309
325
|
- lib/printavo/resources/threads.rb
|