printavo-ruby 0.10.0 → 0.12.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5c7c947ef3f0582fd5c30b1aa44f69cfdc2ba135ac4b5b616db3fc5c63615322
4
- data.tar.gz: 664d2cafd355a83630af29c9902cf89dc2af838694cb91cc6ba182603d115a92
3
+ metadata.gz: 07267da7ecd92123f50dab320f34dd59d32ceeb43a22421d561ec9adb92f04cb
4
+ data.tar.gz: b30f9770630423fca2c7ec5f5d632b5e87c48447d34f485e1c4ce9bdccf88bf4
5
5
  SHA512:
6
- metadata.gz: 7e321c541a352c6ae3983682c03406ca80725499d2014bcfcc6cda1f8f2a8654f4aba9dc25452c7da7225a993ef205f0d698b23f5dfd68396b0f6add13070f27
7
- data.tar.gz: 3182ba400910bc9de615ce19944bbac0b027b80874e35a364e2c64c476d383e86bbed46b501cd0d602dd06c49aa3a20b242f7d510261c734c56649301475e301
6
+ metadata.gz: 2b2421014c3991017e1ed9a626680ab685bfc182af243e690959190d0ee2ee7d08aef65c77cb9f209a77a62a8807af67b4e4da3138270b616ec4042ab78f9228
7
+ data.tar.gz: 5ed669d1ef3f544e92033862894868d567b2e8b53004f8d0c71a967acf8a1955bdfbbe3086316209b37b803be82e8dcc84fd8144200250bb397b2e857d773624
data/docs/CHANGELOG.md CHANGED
@@ -6,6 +6,42 @@ 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.12.0] - 2026-03-31
10
+
11
+ ### Added
12
+ - `Printavo::ProductionFile` model (`id`, `url`, `filename`, `created_at`)
13
+ - `ProductionFiles` resource: `all(order_id:)`, `find(id)`, `create(**input)` / `creates(inputs)`,
14
+ `delete(id)` / `deletes(ids)`
15
+ - `Printavo::Mockup` model (`id`, `url`, `position`, `created_at`)
16
+ - `Mockups` resource: `all(order_id:)`, `find(id)`, `delete(id)` / `deletes(ids)` — no create (mockups are
17
+ attached via `LineItems#mockup_create` and `Imprints#mockup_create`)
18
+ - `Printavo::EmailTemplate` model (`id`, `name`, `subject`, `body`)
19
+ - `EmailTemplates` resource: `all`, `find(id)` — read-only
20
+ - `Printavo::CustomAddress` model (`id`, `name`, `address`, `city`, `state`, `zip`)
21
+ - `CustomAddresses` resource: `all(order_id:)`, `find(id)`, `create(**input)` / `creates(inputs)`,
22
+ `update(id, **input)` / `updates(inputs)`, `delete(id)` / `deletes(ids)`
23
+ - `client.custom_addresses`, `client.email_templates`, `client.mockups`, `client.production_files`
24
+ entry points on `Printavo::Client`
25
+ - 20 new `.graphql` files under `lib/printavo/graphql/`
26
+ - 1 new factory file: `spec/support/factories/media.rb`
27
+
28
+ ## [0.11.0] - 2026-03-31
29
+
30
+ ### Added
31
+ - `Printavo::ApprovalRequest` model (`id`, `status`, `sent_at`, `expires_at`, `contact` — returns `Printavo::Contact`)
32
+ - `ApprovalRequests` resource: `all(order_id:)`, `find(id)`, `create(**input)`,
33
+ `approve(id)`, `revoke(id)`, `unapprove(id)` — action mutations return updated `ApprovalRequest`
34
+ - `Printavo::PresetTask` model (`id`, `body`, `due_offset_days`, `assignee`)
35
+ - `PresetTasks` resource: `find(id)`, `create(**input)`, `update(id, **input)`, `delete(id)` —
36
+ no standalone listing; preset tasks are accessed via `PresetTaskGroup#tasks`
37
+ - `Printavo::PresetTaskGroup` model (`id`, `name`, `tasks` — returns `[PresetTask]`)
38
+ - `PresetTaskGroups` resource: `all`, `find(id)`, `create(**input)`, `update(id, **input)`,
39
+ `delete(id)`, `apply(id, order_id:)` — `apply` returns `[Printavo::Task]` (live tasks created on the order)
40
+ - `client.approval_requests`, `client.preset_task_groups`, `client.preset_tasks`
41
+ entry points on `Printavo::Client`
42
+ - 16 new `.graphql` files under `lib/printavo/graphql/`
43
+ - 2 new factory files: `spec/support/factories/approval_request.rb`, `spec/support/factories/preset_task.rb`
44
+
9
45
  ## [0.10.0] - 2026-03-31
10
46
 
11
47
  ### Added
data/docs/TODO.md CHANGED
@@ -147,14 +147,14 @@ return values — they are exposed via model field accessors, not separate resou
147
147
 
148
148
  ---
149
149
 
150
- ### Approvals
150
+ ### Approvals
151
151
 
152
- - [ ] `Printavo::ApprovalRequest` model (`id`, `status`, `sentAt`, `expiresAt`, `contact`)
153
- - [ ] `ApprovalRequests` resource: `all(order_id:)`, `find(id)`
154
- - [ ] `approvalRequestCreate` mutation
155
- - [ ] `approvalRequestApprove(id:)` mutation
156
- - [ ] `approvalRequestRevoke(id:)` mutation
157
- - [ ] `approvalRequestUnapprove(id:)` mutation
152
+ - [x] `Printavo::ApprovalRequest` model (`id`, `status`, `sent_at`, `expires_at`, `contact`)
153
+ - [x] `ApprovalRequests` resource: `all(order_id:)`, `find(id)`
154
+ - [x] `approvalRequestCreate` mutation
155
+ - [x] `approvalRequestApprove(id:)` mutation
156
+ - [x] `approvalRequestRevoke(id:)` mutation
157
+ - [x] `approvalRequestUnapprove(id:)` mutation
158
158
 
159
159
  ### Categories ✅
160
160
 
@@ -166,13 +166,13 @@ return values — they are exposed via model field accessors, not separate resou
166
166
  - [ ] `Printavo::ContractorProfile` model (`id`, `name`, `email`)
167
167
  - [ ] `ContractorProfiles` resource: `all`, `find(id)` — contractors assignable to invoices
168
168
 
169
- ### Custom Addresses
169
+ ### Custom Addresses
170
170
 
171
- - [ ] `Printavo::CustomAddress` model (`id`, `name`, `address`, `city`, `state`, `zip`)
172
- - [ ] `CustomAddresses` resource: `all(order_id:)`, `find(id)`, `create`, `update`, `delete`
173
- - [ ] `customAddressCreate` / `customAddressCreates` (bulk) mutations
174
- - [ ] `customAddressUpdate` / `customAddressUpdates` (bulk) mutations
175
- - [ ] `customAddressDelete` / `customAddressDeletes` (bulk) mutations
171
+ - [x] `Printavo::CustomAddress` model (`id`, `name`, `address`, `city`, `state`, `zip`)
172
+ - [x] `CustomAddresses` resource: `all(order_id:)`, `find(id)`, `create`, `update`, `delete`
173
+ - [x] `customAddressCreate` / `customAddressCreates` (bulk) mutations
174
+ - [x] `customAddressUpdate` / `customAddressUpdates` (bulk) mutations
175
+ - [x] `customAddressDelete` / `customAddressDeletes` (bulk) mutations
176
176
 
177
177
  ### Delivery Methods
178
178
 
@@ -180,10 +180,10 @@ return values — they are exposed via model field accessors, not separate resou
180
180
  - [ ] `DeliveryMethods` resource: `all`, `find(id)`, `create`, `update`, `archive`
181
181
  - [ ] `deliveryMethodCreate`, `deliveryMethodUpdate`, `deliveryMethodArchive` mutations
182
182
 
183
- ### Email Templates
183
+ ### Email Templates
184
184
 
185
- - [ ] `Printavo::EmailTemplate` model (`id`, `name`, `subject`, `body`)
186
- - [ ] `EmailTemplates` resource: `all`, `find(id)`
185
+ - [x] `Printavo::EmailTemplate` model (`id`, `name`, `subject`, `body`)
186
+ - [x] `EmailTemplates` resource: `all`, `find(id)`
187
187
 
188
188
  ### Expenses ✅
189
189
 
@@ -233,15 +233,15 @@ return values — they are exposed via model field accessors, not separate resou
233
233
  - [x] `MerchOrders` resource: `all`, `find(id)`
234
234
  - [x] `client.merch_stores` / `client.merch_orders` entry points
235
235
 
236
- ### Mockups & Production Files
236
+ ### Mockups & Production Files
237
237
 
238
- - [ ] `Printavo::Mockup` model (`id`, `url`, `position`, `createdAt`)
239
- - [ ] `Printavo::ProductionFile` model (`id`, `url`, `filename`, `createdAt`)
240
- - [ ] `Mockups` resource: `all(order_id:)`, `find(id)`, `delete`
241
- - [ ] `mockupDelete` / `mockupDeletes` (bulk) mutations
242
- - [ ] `ProductionFiles` resource: `all(order_id:)`, `find(id)`, `create`, `delete`
243
- - [ ] `productionFileCreate` / `productionFileCreates` (bulk) mutations
244
- - [ ] `productionFileDelete` / `productionFileDeletes` (bulk) mutations
238
+ - [x] `Printavo::Mockup` model (`id`, `url`, `position`, `created_at`)
239
+ - [x] `Printavo::ProductionFile` model (`id`, `url`, `filename`, `created_at`)
240
+ - [x] `Mockups` resource: `all(order_id:)`, `find(id)`, `delete`, `deletes`
241
+ - [x] `mockupDelete` / `mockupDeletes` (bulk) mutations
242
+ - [x] `ProductionFiles` resource: `all(order_id:)`, `find(id)`, `create`, `creates`, `delete`, `deletes`
243
+ - [x] `productionFileCreate` / `productionFileCreates` (bulk) mutations
244
+ - [x] `productionFileDelete` / `productionFileDeletes` (bulk) mutations
245
245
 
246
246
  ### Payments ✅
247
247
 
@@ -254,15 +254,15 @@ return values — they are exposed via model field accessors, not separate resou
254
254
  - [x] `PaymentTerms` resource: `all`, `find(id)`, `create`, `update`, `archive`
255
255
  - [x] `paymentTermCreate`, `paymentTermUpdate`, `paymentTermArchive` mutations
256
256
 
257
- ### Preset Tasks
257
+ ### Preset Tasks
258
258
 
259
- - [ ] `Printavo::PresetTask` model (`id`, `body`, `dueOffsetDays`, `assignee`)
260
- - [ ] `Printavo::PresetTaskGroup` model (`id`, `name`, `tasks`)
261
- - [ ] `PresetTasks` resource: `find(id)`, `create`, `update`, `delete`
262
- - [ ] `presetTaskCreate`, `presetTaskUpdate`, `presetTaskDelete` mutations
263
- - [ ] `PresetTaskGroups` resource: `all`, `find(id)`, `create`, `update`, `delete`, `apply`
264
- - [ ] `presetTaskGroupCreate`, `presetTaskGroupUpdate`, `presetTaskGroupDelete` mutations
265
- - [ ] `presetTaskGroupApply(id:, order_id:)` mutation — applies a group to an order
259
+ - [x] `Printavo::PresetTask` model (`id`, `body`, `due_offset_days`, `assignee`)
260
+ - [x] `Printavo::PresetTaskGroup` model (`id`, `name`, `tasks`)
261
+ - [x] `PresetTasks` resource: `find(id)`, `create`, `update`, `delete`
262
+ - [x] `presetTaskCreate`, `presetTaskUpdate`, `presetTaskDelete` mutations
263
+ - [x] `PresetTaskGroups` resource: `all`, `find(id)`, `create`, `update`, `delete`, `apply`
264
+ - [x] `presetTaskGroupCreate`, `presetTaskGroupUpdate`, `presetTaskGroupDelete` mutations
265
+ - [x] `presetTaskGroupApply(id:, order_id:)` mutation — applies a group to an order
266
266
 
267
267
  ### Product Catalog & Pricing ✅
268
268
 
@@ -343,18 +343,18 @@ return values — they are exposed via model field accessors, not separate resou
343
343
  - [x] `PaymentRequests` resource (`all`, `find`, `create`, `delete`)
344
344
  - [x] `PaymentTerms` resource (`all`, `find`, `create`, `update`, `archive`)
345
345
 
346
- ### v0.11.0 — Workflow: Approvals & Preset Tasks
346
+ ### v0.11.0 — Workflow: Approvals & Preset Tasks
347
347
 
348
- - [ ] `ApprovalRequests` resource (`all`, `find`, `create`, `approve`, `revoke`, `unapprove`)
349
- - [ ] `PresetTasks` resource (`find`, `create`, `update`, `delete`)
350
- - [ ] `PresetTaskGroups` resource (`all`, `find`, `create`, `update`, `delete`, `apply`)
348
+ - [x] `ApprovalRequests` resource (`all`, `find`, `create`, `approve`, `revoke`, `unapprove`)
349
+ - [x] `PresetTasks` resource (`find`, `create`, `update`, `delete`)
350
+ - [x] `PresetTaskGroups` resource (`all`, `find`, `create`, `update`, `delete`, `apply`)
351
351
 
352
- ### v0.12.0 — Files, Media & Communication
352
+ ### v0.12.0 — Files, Media & Communication
353
353
 
354
- - [ ] `ProductionFiles` resource (`all`, `find`, `create`/`creates`, `delete`/`deletes`)
355
- - [ ] `Mockups` resource (`all`, `find`, `delete`/`deletes`)
356
- - [ ] `EmailTemplates` resource (`all`, `find`)
357
- - [ ] `CustomAddresses` resource (`all`, `find`, `create`/`creates`, `update`/`updates`, `delete`/`deletes`)
354
+ - [x] `ProductionFiles` resource (`all`, `find`, `create`/`creates`, `delete`/`deletes`)
355
+ - [x] `Mockups` resource (`all`, `find`, `delete`/`deletes`)
356
+ - [x] `EmailTemplates` resource (`all`, `find`)
357
+ - [x] `CustomAddresses` resource (`all`, `find`, `create`/`creates`, `update`/`updates`, `delete`/`deletes`)
358
358
 
359
359
  ### v0.13.0 — People, Orgs & Reference Data
360
360
 
@@ -29,6 +29,10 @@ module Printavo
29
29
  Resources::Account.new(@graphql)
30
30
  end
31
31
 
32
+ def approval_requests
33
+ Resources::ApprovalRequests.new(@graphql)
34
+ end
35
+
32
36
  def categories
33
37
  Resources::Categories.new(@graphql)
34
38
  end
@@ -37,10 +41,18 @@ module Printavo
37
41
  Resources::Contacts.new(@graphql)
38
42
  end
39
43
 
44
+ def custom_addresses
45
+ Resources::CustomAddresses.new(@graphql)
46
+ end
47
+
40
48
  def customers
41
49
  Resources::Customers.new(@graphql)
42
50
  end
43
51
 
52
+ def email_templates
53
+ Resources::EmailTemplates.new(@graphql)
54
+ end
55
+
44
56
  def expenses
45
57
  Resources::Expenses.new(@graphql)
46
58
  end
@@ -93,6 +105,10 @@ module Printavo
93
105
  Resources::MerchStores.new(@graphql)
94
106
  end
95
107
 
108
+ def mockups
109
+ Resources::Mockups.new(@graphql)
110
+ end
111
+
96
112
  def orders
97
113
  Resources::Orders.new(@graphql)
98
114
  end
@@ -109,10 +125,22 @@ module Printavo
109
125
  Resources::Payments.new(@graphql)
110
126
  end
111
127
 
128
+ def preset_task_groups
129
+ Resources::PresetTaskGroups.new(@graphql)
130
+ end
131
+
132
+ def preset_tasks
133
+ Resources::PresetTasks.new(@graphql)
134
+ end
135
+
112
136
  def pricing_matrices
113
137
  Resources::PricingMatrices.new(@graphql)
114
138
  end
115
139
 
140
+ def production_files
141
+ Resources::ProductionFiles.new(@graphql)
142
+ end
143
+
116
144
  def products
117
145
  Resources::Products.new(@graphql)
118
146
  end
@@ -0,0 +1,12 @@
1
+ # lib/printavo/models/approval_request.rb
2
+ # frozen_string_literal: true
3
+
4
+ module Printavo
5
+ class ApprovalRequest < Models::Base
6
+ def id = self['id']
7
+ def status = self['status']
8
+ def sent_at = self['sentAt']
9
+ def expires_at = self['expiresAt']
10
+ def contact = self['contact'] && Contact.new(self['contact'])
11
+ end
12
+ end
@@ -0,0 +1,13 @@
1
+ # lib/printavo/models/custom_address.rb
2
+ # frozen_string_literal: true
3
+
4
+ module Printavo
5
+ class CustomAddress < Models::Base
6
+ def id = self['id']
7
+ def name = self['name']
8
+ def address = self['address']
9
+ def city = self['city']
10
+ def state = self['state']
11
+ def zip = self['zip']
12
+ end
13
+ end
@@ -0,0 +1,11 @@
1
+ # lib/printavo/models/email_template.rb
2
+ # frozen_string_literal: true
3
+
4
+ module Printavo
5
+ class EmailTemplate < Models::Base
6
+ def id = self['id']
7
+ def name = self['name']
8
+ def subject = self['subject']
9
+ def body = self['body']
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ # lib/printavo/models/mockup.rb
2
+ # frozen_string_literal: true
3
+
4
+ module Printavo
5
+ class Mockup < Models::Base
6
+ def id = self['id']
7
+ def url = self['url']
8
+ def position = self['position']
9
+ def created_at = self['createdAt']
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ # lib/printavo/models/preset_task.rb
2
+ # frozen_string_literal: true
3
+
4
+ module Printavo
5
+ class PresetTask < Models::Base
6
+ def id = self['id']
7
+ def body = self['body']
8
+ def due_offset_days = self['dueOffsetDays']
9
+ def assignee = self['assignee']
10
+ end
11
+ end
@@ -0,0 +1,10 @@
1
+ # lib/printavo/models/preset_task_group.rb
2
+ # frozen_string_literal: true
3
+
4
+ module Printavo
5
+ class PresetTaskGroup < Models::Base
6
+ def id = self['id']
7
+ def name = self['name']
8
+ def tasks = Array(self['tasks']).map { |attrs| PresetTask.new(attrs) }
9
+ end
10
+ end
@@ -0,0 +1,11 @@
1
+ # lib/printavo/models/production_file.rb
2
+ # frozen_string_literal: true
3
+
4
+ module Printavo
5
+ class ProductionFile < Models::Base
6
+ def id = self['id']
7
+ def url = self['url']
8
+ def filename = self['filename']
9
+ def created_at = self['createdAt']
10
+ end
11
+ end
@@ -0,0 +1,60 @@
1
+ # lib/printavo/resources/approval_requests.rb
2
+ # frozen_string_literal: true
3
+
4
+ module Printavo
5
+ module Resources
6
+ class ApprovalRequests < Base
7
+ ALL_QUERY = File.read(File.join(__dir__, '../graphql/approval_requests/all.graphql')).freeze
8
+ FIND_QUERY = File.read(File.join(__dir__, '../graphql/approval_requests/find.graphql')).freeze
9
+ CREATE_MUTATION = File.read(File.join(__dir__, '../graphql/approval_requests/create.graphql')).freeze
10
+ APPROVE_MUTATION = File.read(File.join(__dir__, '../graphql/approval_requests/approve.graphql')).freeze
11
+ REVOKE_MUTATION = File.read(File.join(__dir__, '../graphql/approval_requests/revoke.graphql')).freeze
12
+ UNAPPROVE_MUTATION = File.read(File.join(__dir__, '../graphql/approval_requests/unapprove.graphql')).freeze
13
+
14
+ def all(order_id:, first: 25, after: nil)
15
+ fetch_page(order_id: order_id, first: first, after: after).records
16
+ end
17
+
18
+ def find(id)
19
+ data = @graphql.query(FIND_QUERY, variables: { id: id.to_s })
20
+ Printavo::ApprovalRequest.new(data['approvalRequest'])
21
+ end
22
+
23
+ def create(**input)
24
+ data = @graphql.mutate(CREATE_MUTATION, variables: { input: camelize_keys(input) })
25
+ Printavo::ApprovalRequest.new(data['approvalRequestCreate'])
26
+ end
27
+
28
+ def approve(id)
29
+ data = @graphql.mutate(APPROVE_MUTATION, variables: { id: id.to_s })
30
+ Printavo::ApprovalRequest.new(data['approvalRequestApprove'])
31
+ end
32
+
33
+ def revoke(id)
34
+ data = @graphql.mutate(REVOKE_MUTATION, variables: { id: id.to_s })
35
+ Printavo::ApprovalRequest.new(data['approvalRequestRevoke'])
36
+ end
37
+
38
+ def unapprove(id)
39
+ data = @graphql.mutate(UNAPPROVE_MUTATION, variables: { id: id.to_s })
40
+ Printavo::ApprovalRequest.new(data['approvalRequestUnapprove'])
41
+ end
42
+
43
+ private
44
+
45
+ def fetch_page(order_id:, first: 25, after: nil, **)
46
+ data = @graphql.query(
47
+ ALL_QUERY,
48
+ variables: { orderId: order_id.to_s, first: first, after: after }
49
+ )
50
+ nodes = data['order']['approvalRequests']['nodes'].map { |attrs| Printavo::ApprovalRequest.new(attrs) }
51
+ page_info = data['order']['approvalRequests']['pageInfo']
52
+ Printavo::Page.new(
53
+ records: nodes,
54
+ has_next_page: page_info['hasNextPage'],
55
+ end_cursor: page_info['endCursor']
56
+ )
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,72 @@
1
+ # lib/printavo/resources/custom_addresses.rb
2
+ # frozen_string_literal: true
3
+
4
+ module Printavo
5
+ module Resources
6
+ class CustomAddresses < Base
7
+ ALL_QUERY = File.read(File.join(__dir__, '../graphql/custom_addresses/all.graphql')).freeze
8
+ FIND_QUERY = File.read(File.join(__dir__, '../graphql/custom_addresses/find.graphql')).freeze
9
+ CREATE_MUTATION = File.read(File.join(__dir__, '../graphql/custom_addresses/create.graphql')).freeze
10
+ CREATES_MUTATION = File.read(File.join(__dir__, '../graphql/custom_addresses/creates.graphql')).freeze
11
+ UPDATE_MUTATION = File.read(File.join(__dir__, '../graphql/custom_addresses/update.graphql')).freeze
12
+ UPDATES_MUTATION = File.read(File.join(__dir__, '../graphql/custom_addresses/updates.graphql')).freeze
13
+ DELETE_MUTATION = File.read(File.join(__dir__, '../graphql/custom_addresses/delete.graphql')).freeze
14
+ DELETES_MUTATION = File.read(File.join(__dir__, '../graphql/custom_addresses/deletes.graphql')).freeze
15
+
16
+ def all(order_id:, first: 25, after: nil)
17
+ fetch_page(order_id: order_id, first: first, after: after).records
18
+ end
19
+
20
+ def find(id)
21
+ data = @graphql.query(FIND_QUERY, variables: { id: id.to_s })
22
+ Printavo::CustomAddress.new(data['customAddress'])
23
+ end
24
+
25
+ def create(**input)
26
+ data = @graphql.mutate(CREATE_MUTATION, variables: { input: camelize_keys(input) })
27
+ Printavo::CustomAddress.new(data['customAddressCreate'])
28
+ end
29
+
30
+ def creates(inputs)
31
+ data = @graphql.mutate(CREATES_MUTATION, variables: { inputs: inputs.map { |i| camelize_keys(i) } })
32
+ data['customAddressCreates'].map { |attrs| Printavo::CustomAddress.new(attrs) }
33
+ end
34
+
35
+ def update(id, **input)
36
+ data = @graphql.mutate(UPDATE_MUTATION, variables: { id: id.to_s, input: camelize_keys(input) })
37
+ Printavo::CustomAddress.new(data['customAddressUpdate'])
38
+ end
39
+
40
+ def updates(inputs)
41
+ data = @graphql.mutate(UPDATES_MUTATION, variables: { inputs: inputs.map { |i| camelize_keys(i) } })
42
+ data['customAddressUpdates'].map { |attrs| Printavo::CustomAddress.new(attrs) }
43
+ end
44
+
45
+ def delete(id)
46
+ @graphql.mutate(DELETE_MUTATION, variables: { id: id.to_s })
47
+ nil
48
+ end
49
+
50
+ def deletes(ids)
51
+ @graphql.mutate(DELETES_MUTATION, variables: { ids: ids.map(&:to_s) })
52
+ nil
53
+ end
54
+
55
+ private
56
+
57
+ def fetch_page(order_id:, first: 25, after: nil, **)
58
+ data = @graphql.query(
59
+ ALL_QUERY,
60
+ variables: { orderId: order_id.to_s, first: first, after: after }
61
+ )
62
+ nodes = data['order']['customAddresses']['nodes'].map { |attrs| Printavo::CustomAddress.new(attrs) }
63
+ page_info = data['order']['customAddresses']['pageInfo']
64
+ Printavo::Page.new(
65
+ records: nodes,
66
+ has_next_page: page_info['hasNextPage'],
67
+ end_cursor: page_info['endCursor']
68
+ )
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,33 @@
1
+ # lib/printavo/resources/email_templates.rb
2
+ # frozen_string_literal: true
3
+
4
+ module Printavo
5
+ module Resources
6
+ class EmailTemplates < Base
7
+ ALL_QUERY = File.read(File.join(__dir__, '../graphql/email_templates/all.graphql')).freeze
8
+ FIND_QUERY = File.read(File.join(__dir__, '../graphql/email_templates/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::EmailTemplate.new(data['emailTemplate'])
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['emailTemplates']['nodes'].map { |attrs| Printavo::EmailTemplate.new(attrs) }
24
+ page_info = data['emailTemplates']['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/mockups.rb
2
+ # frozen_string_literal: true
3
+
4
+ module Printavo
5
+ module Resources
6
+ class Mockups < Base
7
+ ALL_QUERY = File.read(File.join(__dir__, '../graphql/mockups/all.graphql')).freeze
8
+ FIND_QUERY = File.read(File.join(__dir__, '../graphql/mockups/find.graphql')).freeze
9
+ DELETE_MUTATION = File.read(File.join(__dir__, '../graphql/mockups/delete.graphql')).freeze
10
+ DELETES_MUTATION = File.read(File.join(__dir__, '../graphql/mockups/deletes.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::Mockup.new(data['mockup'])
19
+ end
20
+
21
+ def delete(id)
22
+ @graphql.mutate(DELETE_MUTATION, variables: { id: id.to_s })
23
+ nil
24
+ end
25
+
26
+ def deletes(ids)
27
+ @graphql.mutate(DELETES_MUTATION, variables: { ids: ids.map(&: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']['mockups']['nodes'].map { |attrs| Printavo::Mockup.new(attrs) }
39
+ page_info = data['order']['mockups']['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,57 @@
1
+ # lib/printavo/resources/preset_task_groups.rb
2
+ # frozen_string_literal: true
3
+
4
+ module Printavo
5
+ module Resources
6
+ class PresetTaskGroups < Base
7
+ ALL_QUERY = File.read(File.join(__dir__, '../graphql/preset_task_groups/all.graphql')).freeze
8
+ FIND_QUERY = File.read(File.join(__dir__, '../graphql/preset_task_groups/find.graphql')).freeze
9
+ CREATE_MUTATION = File.read(File.join(__dir__, '../graphql/preset_task_groups/create.graphql')).freeze
10
+ UPDATE_MUTATION = File.read(File.join(__dir__, '../graphql/preset_task_groups/update.graphql')).freeze
11
+ DELETE_MUTATION = File.read(File.join(__dir__, '../graphql/preset_task_groups/delete.graphql')).freeze
12
+ APPLY_MUTATION = File.read(File.join(__dir__, '../graphql/preset_task_groups/apply.graphql')).freeze
13
+
14
+ def all(first: 25, after: nil)
15
+ fetch_page(first: first, after: after).records
16
+ end
17
+
18
+ def find(id)
19
+ data = @graphql.query(FIND_QUERY, variables: { id: id.to_s })
20
+ Printavo::PresetTaskGroup.new(data['presetTaskGroup'])
21
+ end
22
+
23
+ def create(**input)
24
+ data = @graphql.mutate(CREATE_MUTATION, variables: { input: camelize_keys(input) })
25
+ Printavo::PresetTaskGroup.new(data['presetTaskGroupCreate'])
26
+ end
27
+
28
+ def update(id, **input)
29
+ data = @graphql.mutate(UPDATE_MUTATION, variables: { id: id.to_s, input: camelize_keys(input) })
30
+ Printavo::PresetTaskGroup.new(data['presetTaskGroupUpdate'])
31
+ end
32
+
33
+ def delete(id)
34
+ @graphql.mutate(DELETE_MUTATION, variables: { id: id.to_s })
35
+ nil
36
+ end
37
+
38
+ def apply(id, order_id:)
39
+ data = @graphql.mutate(APPLY_MUTATION, variables: { id: id.to_s, orderId: order_id.to_s })
40
+ data['presetTaskGroupApply'].map { |attrs| Printavo::Task.new(attrs) }
41
+ end
42
+
43
+ private
44
+
45
+ def fetch_page(first: 25, after: nil, **)
46
+ data = @graphql.query(ALL_QUERY, variables: { first: first, after: after })
47
+ nodes = data['presetTaskGroups']['nodes'].map { |attrs| Printavo::PresetTaskGroup.new(attrs) }
48
+ page_info = data['presetTaskGroups']['pageInfo']
49
+ Printavo::Page.new(
50
+ records: nodes,
51
+ has_next_page: page_info['hasNextPage'],
52
+ end_cursor: page_info['endCursor']
53
+ )
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,33 @@
1
+ # lib/printavo/resources/preset_tasks.rb
2
+ # frozen_string_literal: true
3
+
4
+ module Printavo
5
+ module Resources
6
+ class PresetTasks < Base
7
+ FIND_QUERY = File.read(File.join(__dir__, '../graphql/preset_tasks/find.graphql')).freeze
8
+ CREATE_MUTATION = File.read(File.join(__dir__, '../graphql/preset_tasks/create.graphql')).freeze
9
+ UPDATE_MUTATION = File.read(File.join(__dir__, '../graphql/preset_tasks/update.graphql')).freeze
10
+ DELETE_MUTATION = File.read(File.join(__dir__, '../graphql/preset_tasks/delete.graphql')).freeze
11
+
12
+ def find(id)
13
+ data = @graphql.query(FIND_QUERY, variables: { id: id.to_s })
14
+ Printavo::PresetTask.new(data['presetTask'])
15
+ end
16
+
17
+ def create(**input)
18
+ data = @graphql.mutate(CREATE_MUTATION, variables: { input: camelize_keys(input) })
19
+ Printavo::PresetTask.new(data['presetTaskCreate'])
20
+ end
21
+
22
+ def update(id, **input)
23
+ data = @graphql.mutate(UPDATE_MUTATION, variables: { id: id.to_s, input: camelize_keys(input) })
24
+ Printavo::PresetTask.new(data['presetTaskUpdate'])
25
+ end
26
+
27
+ def delete(id)
28
+ @graphql.mutate(DELETE_MUTATION, variables: { id: id.to_s })
29
+ nil
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,60 @@
1
+ # lib/printavo/resources/production_files.rb
2
+ # frozen_string_literal: true
3
+
4
+ module Printavo
5
+ module Resources
6
+ class ProductionFiles < Base
7
+ ALL_QUERY = File.read(File.join(__dir__, '../graphql/production_files/all.graphql')).freeze
8
+ FIND_QUERY = File.read(File.join(__dir__, '../graphql/production_files/find.graphql')).freeze
9
+ CREATE_MUTATION = File.read(File.join(__dir__, '../graphql/production_files/create.graphql')).freeze
10
+ CREATES_MUTATION = File.read(File.join(__dir__, '../graphql/production_files/creates.graphql')).freeze
11
+ DELETE_MUTATION = File.read(File.join(__dir__, '../graphql/production_files/delete.graphql')).freeze
12
+ DELETES_MUTATION = File.read(File.join(__dir__, '../graphql/production_files/deletes.graphql')).freeze
13
+
14
+ def all(order_id:, first: 25, after: nil)
15
+ fetch_page(order_id: order_id, first: first, after: after).records
16
+ end
17
+
18
+ def find(id)
19
+ data = @graphql.query(FIND_QUERY, variables: { id: id.to_s })
20
+ Printavo::ProductionFile.new(data['productionFile'])
21
+ end
22
+
23
+ def create(**input)
24
+ data = @graphql.mutate(CREATE_MUTATION, variables: { input: camelize_keys(input) })
25
+ Printavo::ProductionFile.new(data['productionFileCreate'])
26
+ end
27
+
28
+ def creates(inputs)
29
+ data = @graphql.mutate(CREATES_MUTATION, variables: { inputs: inputs.map { |i| camelize_keys(i) } })
30
+ data['productionFileCreates'].map { |attrs| Printavo::ProductionFile.new(attrs) }
31
+ end
32
+
33
+ def delete(id)
34
+ @graphql.mutate(DELETE_MUTATION, variables: { id: id.to_s })
35
+ nil
36
+ end
37
+
38
+ def deletes(ids)
39
+ @graphql.mutate(DELETES_MUTATION, variables: { ids: ids.map(&:to_s) })
40
+ nil
41
+ end
42
+
43
+ private
44
+
45
+ def fetch_page(order_id:, first: 25, after: nil, **)
46
+ data = @graphql.query(
47
+ ALL_QUERY,
48
+ variables: { orderId: order_id.to_s, first: first, after: after }
49
+ )
50
+ nodes = data['order']['productionFiles']['nodes'].map { |attrs| Printavo::ProductionFile.new(attrs) }
51
+ page_info = data['order']['productionFiles']['pageInfo']
52
+ Printavo::Page.new(
53
+ records: nodes,
54
+ has_next_page: page_info['hasNextPage'],
55
+ end_cursor: page_info['endCursor']
56
+ )
57
+ end
58
+ end
59
+ end
60
+ end
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Printavo
5
- VERSION = '0.10.0'
5
+ VERSION = '0.12.0'
6
6
  end
data/lib/printavo.rb CHANGED
@@ -13,9 +13,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/approval_request'
16
17
  require_relative 'printavo/models/category'
17
18
  require_relative 'printavo/models/contact'
19
+ require_relative 'printavo/models/custom_address'
18
20
  require_relative 'printavo/models/customer'
21
+ require_relative 'printavo/models/email_template'
19
22
  require_relative 'printavo/models/expense'
20
23
  require_relative 'printavo/models/fee'
21
24
  require_relative 'printavo/models/imprint'
@@ -26,12 +29,16 @@ require_relative 'printavo/models/line_item'
26
29
  require_relative 'printavo/models/line_item_group'
27
30
  require_relative 'printavo/models/merch_order'
28
31
  require_relative 'printavo/models/merch_store'
32
+ require_relative 'printavo/models/mockup'
29
33
  require_relative 'printavo/models/order'
30
34
  require_relative 'printavo/models/payment'
31
35
  require_relative 'printavo/models/payment_request'
32
36
  require_relative 'printavo/models/payment_term'
37
+ require_relative 'printavo/models/preset_task'
38
+ require_relative 'printavo/models/preset_task_group'
33
39
  require_relative 'printavo/models/pricing_matrix'
34
40
  require_relative 'printavo/models/product'
41
+ require_relative 'printavo/models/production_file'
35
42
  require_relative 'printavo/models/status'
36
43
  require_relative 'printavo/models/task'
37
44
  require_relative 'printavo/models/thread'
@@ -39,9 +46,12 @@ require_relative 'printavo/models/transaction'
39
46
  require_relative 'printavo/models/transaction_payment'
40
47
  require_relative 'printavo/resources/base'
41
48
  require_relative 'printavo/resources/account'
49
+ require_relative 'printavo/resources/approval_requests'
42
50
  require_relative 'printavo/resources/categories'
43
51
  require_relative 'printavo/resources/contacts'
52
+ require_relative 'printavo/resources/custom_addresses'
44
53
  require_relative 'printavo/resources/customers'
54
+ require_relative 'printavo/resources/email_templates'
45
55
  require_relative 'printavo/resources/expenses'
46
56
  require_relative 'printavo/resources/fees'
47
57
  require_relative 'printavo/resources/imprints'
@@ -52,11 +62,15 @@ require_relative 'printavo/resources/line_item_groups'
52
62
  require_relative 'printavo/resources/line_items'
53
63
  require_relative 'printavo/resources/merch_orders'
54
64
  require_relative 'printavo/resources/merch_stores'
65
+ require_relative 'printavo/resources/mockups'
55
66
  require_relative 'printavo/resources/orders'
56
67
  require_relative 'printavo/resources/payment_requests'
57
68
  require_relative 'printavo/resources/payment_terms'
58
69
  require_relative 'printavo/resources/payments'
70
+ require_relative 'printavo/resources/preset_task_groups'
71
+ require_relative 'printavo/resources/preset_tasks'
59
72
  require_relative 'printavo/resources/pricing_matrices'
73
+ require_relative 'printavo/resources/production_files'
60
74
  require_relative 'printavo/resources/products'
61
75
  require_relative 'printavo/resources/statuses'
62
76
  require_relative 'printavo/resources/tasks'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: printavo-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stan Carver II
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-03-31 00:00:00.000000000 Z
11
+ date: 2026-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -273,10 +273,13 @@ files:
273
273
  - lib/printavo/errors.rb
274
274
  - lib/printavo/graphql_client.rb
275
275
  - lib/printavo/models/account.rb
276
+ - lib/printavo/models/approval_request.rb
276
277
  - lib/printavo/models/base.rb
277
278
  - lib/printavo/models/category.rb
278
279
  - lib/printavo/models/contact.rb
280
+ - lib/printavo/models/custom_address.rb
279
281
  - lib/printavo/models/customer.rb
282
+ - lib/printavo/models/email_template.rb
280
283
  - lib/printavo/models/expense.rb
281
284
  - lib/printavo/models/fee.rb
282
285
  - lib/printavo/models/imprint.rb
@@ -287,12 +290,16 @@ files:
287
290
  - lib/printavo/models/line_item_group.rb
288
291
  - lib/printavo/models/merch_order.rb
289
292
  - lib/printavo/models/merch_store.rb
293
+ - lib/printavo/models/mockup.rb
290
294
  - lib/printavo/models/order.rb
291
295
  - lib/printavo/models/payment.rb
292
296
  - lib/printavo/models/payment_request.rb
293
297
  - lib/printavo/models/payment_term.rb
298
+ - lib/printavo/models/preset_task.rb
299
+ - lib/printavo/models/preset_task_group.rb
294
300
  - lib/printavo/models/pricing_matrix.rb
295
301
  - lib/printavo/models/product.rb
302
+ - lib/printavo/models/production_file.rb
296
303
  - lib/printavo/models/status.rb
297
304
  - lib/printavo/models/task.rb
298
305
  - lib/printavo/models/thread.rb
@@ -300,10 +307,13 @@ files:
300
307
  - lib/printavo/models/transaction_payment.rb
301
308
  - lib/printavo/page.rb
302
309
  - lib/printavo/resources/account.rb
310
+ - lib/printavo/resources/approval_requests.rb
303
311
  - lib/printavo/resources/base.rb
304
312
  - lib/printavo/resources/categories.rb
305
313
  - lib/printavo/resources/contacts.rb
314
+ - lib/printavo/resources/custom_addresses.rb
306
315
  - lib/printavo/resources/customers.rb
316
+ - lib/printavo/resources/email_templates.rb
307
317
  - lib/printavo/resources/expenses.rb
308
318
  - lib/printavo/resources/fees.rb
309
319
  - lib/printavo/resources/imprints.rb
@@ -314,11 +324,15 @@ files:
314
324
  - lib/printavo/resources/line_items.rb
315
325
  - lib/printavo/resources/merch_orders.rb
316
326
  - lib/printavo/resources/merch_stores.rb
327
+ - lib/printavo/resources/mockups.rb
317
328
  - lib/printavo/resources/orders.rb
318
329
  - lib/printavo/resources/payment_requests.rb
319
330
  - lib/printavo/resources/payment_terms.rb
320
331
  - lib/printavo/resources/payments.rb
332
+ - lib/printavo/resources/preset_task_groups.rb
333
+ - lib/printavo/resources/preset_tasks.rb
321
334
  - lib/printavo/resources/pricing_matrices.rb
335
+ - lib/printavo/resources/production_files.rb
322
336
  - lib/printavo/resources/products.rb
323
337
  - lib/printavo/resources/statuses.rb
324
338
  - lib/printavo/resources/tasks.rb