fixably 0.7.0 → 0.8.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/.github/workflows/main.yml +7 -6
- data/.rubocop.yml +11 -3
- data/Gemfile +1 -1
- data/Gemfile.lock +73 -38
- data/README.md +1 -0
- data/docs/order/file.md +32 -0
- data/lib/fixably/actions.rb +6 -8
- data/lib/fixably/active_resource/base.rb +1 -1
- data/lib/fixably/active_resource/paginated_collection.rb +14 -2
- data/lib/fixably/application_resource.rb +2 -2
- data/lib/fixably/authorization.rb +1 -1
- data/lib/fixably/load_from_response.rb +2 -3
- data/lib/fixably/resources/customer.rb +1 -1
- data/lib/fixably/resources/order.rb +8 -0
- data/lib/fixably/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9b0169e30863c4a16ea54283342c20d92bf0364c5cf5fffb373f9b74433aaf43
|
|
4
|
+
data.tar.gz: cfeb515423c5c1f2b15f13ea8e0481150a05e55f56766e0d0f7e28de05fa9acf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fca3f233e8e8b9d848183c3bb4c1fe47ec12cbfc95080353c424aa67f848a9e7b1c211803473b3240510e256160d18303d5ad06f5825c7cfa5b08b967a2f384e
|
|
7
|
+
data.tar.gz: 392ebc34af2148c8c04bdbc147f8d6229c312c3a7caf763c224e7684dddb989b221e46506d115dd98c5e10910e2b7b6d3c3efcda0511fc484a75104dc3d23997
|
data/.github/workflows/main.yml
CHANGED
|
@@ -6,13 +6,14 @@ jobs:
|
|
|
6
6
|
build:
|
|
7
7
|
runs-on: ubuntu-latest
|
|
8
8
|
steps:
|
|
9
|
-
- uses: actions/checkout@
|
|
9
|
+
- uses: actions/checkout@v4
|
|
10
10
|
- name: Set up Ruby
|
|
11
11
|
uses: ruby/setup-ruby@v1
|
|
12
12
|
with:
|
|
13
|
-
ruby-version:
|
|
13
|
+
ruby-version: "4.0"
|
|
14
|
+
# The lockfile names mutant-license, which the Gemfile only asks for given a licence token, and CI has none, so a
|
|
15
|
+
# frozen install would refuse it
|
|
16
|
+
- name: Install dependencies
|
|
17
|
+
run: bundle install
|
|
14
18
|
- name: Run the default task
|
|
15
|
-
run:
|
|
16
|
-
gem install bundler -v 2.2.3
|
|
17
|
-
bundle install
|
|
18
|
-
bundle exec rake
|
|
19
|
+
run: bundle exec rake
|
data/.rubocop.yml
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
plugins:
|
|
2
2
|
- rubocop-performance
|
|
3
3
|
- rubocop-rspec
|
|
4
4
|
|
|
@@ -9,6 +9,9 @@ AllCops:
|
|
|
9
9
|
- bin/**/*
|
|
10
10
|
NewCops: enable
|
|
11
11
|
|
|
12
|
+
Gemspec/DevelopmentDependencies:
|
|
13
|
+
EnforcedStyle: gemspec
|
|
14
|
+
|
|
12
15
|
Layout/DotPosition:
|
|
13
16
|
EnforcedStyle: trailing
|
|
14
17
|
|
|
@@ -20,7 +23,7 @@ Layout/FirstArrayElementIndentation:
|
|
|
20
23
|
EnforcedStyle: consistent
|
|
21
24
|
|
|
22
25
|
Layout/LineLength:
|
|
23
|
-
|
|
26
|
+
AllowedPatterns:
|
|
24
27
|
- \#\s
|
|
25
28
|
|
|
26
29
|
Layout/MultilineMethodCallIndentation:
|
|
@@ -68,10 +71,15 @@ RSpec/BeforeAfterAll:
|
|
|
68
71
|
RSpec/ExampleLength:
|
|
69
72
|
Max: 10
|
|
70
73
|
|
|
71
|
-
RSpec/
|
|
74
|
+
RSpec/SpecFilePathFormat:
|
|
72
75
|
Exclude:
|
|
73
76
|
- "spec/fixably/resources/**/*"
|
|
74
77
|
|
|
78
|
+
# The shared examples take arguments and are included into the example group,
|
|
79
|
+
# where the including spec's lets apply to them
|
|
80
|
+
RSpec/IncludeExamples:
|
|
81
|
+
Enabled: false
|
|
82
|
+
|
|
75
83
|
RSpec/LetSetup:
|
|
76
84
|
Enabled: false
|
|
77
85
|
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
fixably (0.
|
|
4
|
+
fixably (0.8.0)
|
|
5
5
|
activeresource (>= 5, < 7)
|
|
6
6
|
logger (~> 1.6)
|
|
7
7
|
|
|
@@ -36,7 +36,7 @@ GEM
|
|
|
36
36
|
securerandom (>= 0.3)
|
|
37
37
|
tzinfo (~> 2.0, >= 2.0.5)
|
|
38
38
|
uri (>= 0.13.1)
|
|
39
|
-
ast (2.4.
|
|
39
|
+
ast (2.4.3)
|
|
40
40
|
base64 (0.3.0)
|
|
41
41
|
bigdecimal (4.1.2)
|
|
42
42
|
builder (3.3.0)
|
|
@@ -45,29 +45,43 @@ GEM
|
|
|
45
45
|
coderay (1.1.3)
|
|
46
46
|
concurrent-ruby (1.3.8)
|
|
47
47
|
connection_pool (3.0.2)
|
|
48
|
-
diff-lcs (1.
|
|
48
|
+
diff-lcs (1.6.2)
|
|
49
49
|
drb (2.2.3)
|
|
50
|
+
erb (6.0.7)
|
|
50
51
|
i18n (1.15.2)
|
|
51
52
|
concurrent-ruby (~> 1.0)
|
|
52
53
|
io-console (0.8.2)
|
|
54
|
+
irb (1.19.0)
|
|
55
|
+
pp (>= 0.6.0)
|
|
56
|
+
prism (>= 1.3.0)
|
|
57
|
+
rdoc (>= 4.0.0)
|
|
58
|
+
reline (>= 0.4.2)
|
|
53
59
|
json (2.21.2)
|
|
60
|
+
language_server-protocol (3.17.0.6)
|
|
61
|
+
lint_roller (1.1.0)
|
|
54
62
|
logger (1.7.0)
|
|
55
63
|
method_source (1.1.0)
|
|
56
64
|
minitest (6.0.6)
|
|
57
65
|
drb (~> 2.0)
|
|
58
66
|
prism (~> 1.5)
|
|
59
|
-
mutant (0.
|
|
60
|
-
diff-lcs (
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
mutant (0.17.1)
|
|
68
|
+
diff-lcs (>= 1.6, < 3)
|
|
69
|
+
irb (~> 1.15)
|
|
70
|
+
parser (~> 3.3.10)
|
|
71
|
+
regexp_parser (~> 2.10)
|
|
72
|
+
securerandom (>= 0.3)
|
|
73
|
+
sorbet-runtime (~> 0.6.0)
|
|
74
|
+
unparser (>= 0.8.2, < 0.10)
|
|
75
|
+
mutant-rspec (0.17.1)
|
|
76
|
+
mutant (= 0.17.1)
|
|
77
|
+
rspec-core (>= 3.8.0, < 5.0.0)
|
|
78
|
+
parallel (2.3.0)
|
|
79
|
+
parser (3.3.13.0)
|
|
70
80
|
ast (~> 2.4.1)
|
|
81
|
+
racc
|
|
82
|
+
pp (0.6.4)
|
|
83
|
+
prettyprint
|
|
84
|
+
prettyprint (0.2.1)
|
|
71
85
|
prism (1.9.0)
|
|
72
86
|
pry (0.16.0)
|
|
73
87
|
coderay (~> 1.1)
|
|
@@ -76,12 +90,21 @@ GEM
|
|
|
76
90
|
pry-byebug (3.12.0)
|
|
77
91
|
byebug (~> 13.0)
|
|
78
92
|
pry (>= 0.13, < 0.17)
|
|
93
|
+
racc (1.8.1)
|
|
79
94
|
rainbow (3.1.1)
|
|
80
95
|
rake (13.4.2)
|
|
81
|
-
|
|
96
|
+
rbs (4.2.0)
|
|
97
|
+
logger
|
|
98
|
+
prism (>= 1.6.0)
|
|
99
|
+
tsort
|
|
100
|
+
rdoc (8.1.0)
|
|
101
|
+
erb
|
|
102
|
+
prism (>= 1.6.0)
|
|
103
|
+
rbs (>= 4.0.0)
|
|
104
|
+
tsort
|
|
105
|
+
regexp_parser (2.13.1)
|
|
82
106
|
reline (0.7.0)
|
|
83
107
|
io-console (~> 0.5)
|
|
84
|
-
rexml (3.2.5)
|
|
85
108
|
rspec (3.10.0)
|
|
86
109
|
rspec-core (~> 3.10.0)
|
|
87
110
|
rspec-expectations (~> 3.10.0)
|
|
@@ -95,33 +118,44 @@ GEM
|
|
|
95
118
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
96
119
|
rspec-support (~> 3.10.0)
|
|
97
120
|
rspec-support (3.10.3)
|
|
98
|
-
rubocop (1.
|
|
99
|
-
|
|
100
|
-
|
|
121
|
+
rubocop (1.92.2)
|
|
122
|
+
json (>= 2.3)
|
|
123
|
+
language_server-protocol (~> 3.17.0.2)
|
|
124
|
+
lint_roller (~> 1.1.0)
|
|
125
|
+
parallel (>= 1.10)
|
|
126
|
+
parser (>= 3.3.0.2)
|
|
101
127
|
rainbow (>= 2.2.2, < 4.0)
|
|
102
|
-
regexp_parser (>=
|
|
103
|
-
|
|
104
|
-
rubocop-ast (>= 1.15.1, < 2.0)
|
|
128
|
+
regexp_parser (>= 2.11.3, < 3.0)
|
|
129
|
+
rubocop-ast (>= 1.49.0, < 2.0)
|
|
105
130
|
ruby-progressbar (~> 1.7)
|
|
106
|
-
unicode-display_width (>=
|
|
107
|
-
rubocop-ast (1.
|
|
108
|
-
parser (>= 3.
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
rubocop (
|
|
114
|
-
rubocop-
|
|
115
|
-
|
|
116
|
-
|
|
131
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
|
132
|
+
rubocop-ast (1.50.0)
|
|
133
|
+
parser (>= 3.3.7.2)
|
|
134
|
+
prism (~> 1.7)
|
|
135
|
+
rubocop-performance (1.27.0)
|
|
136
|
+
lint_roller (~> 1.1)
|
|
137
|
+
rubocop (>= 1.89.0, < 2.0)
|
|
138
|
+
rubocop-ast (>= 1.47.1, < 2.0)
|
|
139
|
+
rubocop-rake (0.7.1)
|
|
140
|
+
lint_roller (~> 1.1)
|
|
141
|
+
rubocop (>= 1.72.1)
|
|
142
|
+
rubocop-rspec (3.10.2)
|
|
143
|
+
lint_roller (~> 1.1)
|
|
144
|
+
regexp_parser (>= 2.0)
|
|
145
|
+
rubocop (~> 1.86, >= 1.86.2)
|
|
146
|
+
ruby-progressbar (1.13.0)
|
|
117
147
|
securerandom (0.4.1)
|
|
118
|
-
sorbet-runtime (0.
|
|
148
|
+
sorbet-runtime (0.6.13646)
|
|
149
|
+
tsort (0.2.0)
|
|
119
150
|
tzinfo (2.0.6)
|
|
120
151
|
concurrent-ruby (~> 1.0)
|
|
121
|
-
unicode-display_width (
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
152
|
+
unicode-display_width (3.3.0)
|
|
153
|
+
unicode-emoji (~> 4.3)
|
|
154
|
+
unicode-emoji (4.3.0)
|
|
155
|
+
unparser (0.9.0)
|
|
156
|
+
diff-lcs (>= 1.6, < 3)
|
|
157
|
+
parser (>= 3.3.0)
|
|
158
|
+
prism (>= 1.5.1)
|
|
125
159
|
uri (1.1.1)
|
|
126
160
|
|
|
127
161
|
PLATFORMS
|
|
@@ -129,6 +163,7 @@ PLATFORMS
|
|
|
129
163
|
arm64-darwin-22
|
|
130
164
|
arm64-darwin-25
|
|
131
165
|
x86_64-darwin-20
|
|
166
|
+
x86_64-linux
|
|
132
167
|
|
|
133
168
|
DEPENDENCIES
|
|
134
169
|
fixably!
|
data/README.md
CHANGED
|
@@ -118,6 +118,7 @@ Currently supported resources:
|
|
|
118
118
|
- Fixably::Device ([documentation](docs/device.md))
|
|
119
119
|
- Fixably::Location ([documentation](docs/location.md))
|
|
120
120
|
- Fixably::Order ([documentation](docs/order.md))
|
|
121
|
+
- Fixably::Order::File ([documentation](docs/order/file.md))
|
|
121
122
|
- Fixably::Order::Line ([documentation](docs/order/line.md))
|
|
122
123
|
- Fixably::Order::Note ([documentation](docs/order/note.md))
|
|
123
124
|
- Fixably::Order::Task ([documentation](docs/order/task.md))
|
data/docs/order/file.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Fixably::Order::File
|
|
2
|
+
|
|
3
|
+
## List order files
|
|
4
|
+
|
|
5
|
+
```ruby
|
|
6
|
+
Fixably::Order::File.all(order_id: 1_000)
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Fixably leaves quarantined files out of the list. Each file's `url` is a download link that lasts an hour, so list the files again for a fresh one.
|
|
10
|
+
|
|
11
|
+
### Include associations in a list
|
|
12
|
+
|
|
13
|
+
**Created by**
|
|
14
|
+
```ruby
|
|
15
|
+
Fixably::Order::File.includes(:created_by).all(order_id: 1_000)
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Get an order file
|
|
19
|
+
|
|
20
|
+
The Fixably API does not allow an order file to be fetched on its own
|
|
21
|
+
|
|
22
|
+
## Create an order file
|
|
23
|
+
|
|
24
|
+
While supported by Fixably, this feature has not yet been implemented
|
|
25
|
+
|
|
26
|
+
## Update an order file
|
|
27
|
+
|
|
28
|
+
The Fixably API does not allow order files to be updated
|
|
29
|
+
|
|
30
|
+
## Destroy an order file
|
|
31
|
+
|
|
32
|
+
The Fixably API does not allow order files to be destroyed
|
data/lib/fixably/actions.rb
CHANGED
|
@@ -35,17 +35,17 @@ module Fixably
|
|
|
35
35
|
|
|
36
36
|
def create(attributes = {})
|
|
37
37
|
ActionPolicy.new(resource: self).create!
|
|
38
|
-
super
|
|
38
|
+
super
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
def create!(attributes = {})
|
|
42
42
|
ActionPolicy.new(resource: self).create!
|
|
43
|
-
super
|
|
43
|
+
super
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
def delete(id, options = {})
|
|
47
47
|
ActionPolicy.new(resource: self).delete!
|
|
48
|
-
super
|
|
48
|
+
super
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
def exists?(id, options = {})
|
|
@@ -98,7 +98,7 @@ module Fixably
|
|
|
98
98
|
|
|
99
99
|
private
|
|
100
100
|
|
|
101
|
-
# rubocop:disable Metrics/MethodLength
|
|
101
|
+
# rubocop:disable-next Metrics/MethodLength
|
|
102
102
|
def format_actions(values)
|
|
103
103
|
unless values.respond_to?(:to_sym) || values.respond_to?(:to_a)
|
|
104
104
|
raise(
|
|
@@ -117,14 +117,13 @@ module Fixably
|
|
|
117
117
|
action
|
|
118
118
|
end
|
|
119
119
|
end
|
|
120
|
-
# rubocop:enable Metrics/MethodLength
|
|
121
120
|
|
|
122
121
|
def allowed_actions = %i[create delete list show update]
|
|
123
122
|
end
|
|
124
123
|
|
|
125
124
|
def destroy
|
|
126
125
|
ActionPolicy.new(resource: self).delete!
|
|
127
|
-
super
|
|
126
|
+
super
|
|
128
127
|
end
|
|
129
128
|
|
|
130
129
|
def save(validate: true)
|
|
@@ -136,7 +135,7 @@ module Fixably
|
|
|
136
135
|
super()
|
|
137
136
|
end
|
|
138
137
|
|
|
139
|
-
# rubocop:disable Style/RaiseArgs
|
|
138
|
+
# rubocop:disable-next Style/RaiseArgs
|
|
140
139
|
def save!
|
|
141
140
|
if new?
|
|
142
141
|
ActionPolicy.new(resource: self).create!
|
|
@@ -147,6 +146,5 @@ module Fixably
|
|
|
147
146
|
save(validate: false) ||
|
|
148
147
|
raise(::ActiveResource::ResourceInvalid.new(self))
|
|
149
148
|
end
|
|
150
|
-
# rubocop:enable Style/RaiseArgs
|
|
151
149
|
end
|
|
152
150
|
end
|
|
@@ -65,7 +65,7 @@ module Fixably
|
|
|
65
65
|
def next_page
|
|
66
66
|
raise StopIteration, "There are no more pages" unless next_page?
|
|
67
67
|
|
|
68
|
-
where(limit: limit, offset: offset + limit)
|
|
68
|
+
where(page_params(limit: limit, offset: offset + limit))
|
|
69
69
|
end
|
|
70
70
|
|
|
71
71
|
def next_page?
|
|
@@ -80,12 +80,24 @@ module Fixably
|
|
|
80
80
|
new_limit += new_offset if new_offset.negative?
|
|
81
81
|
new_offset = 0 if new_offset.negative?
|
|
82
82
|
|
|
83
|
-
where(limit: new_limit, offset: new_offset)
|
|
83
|
+
where(page_params(limit: new_limit, offset: new_offset))
|
|
84
84
|
end
|
|
85
85
|
|
|
86
86
|
def previous_page?
|
|
87
87
|
offset.positive?
|
|
88
88
|
end
|
|
89
|
+
|
|
90
|
+
private
|
|
91
|
+
|
|
92
|
+
# Active Resource keeps a nested resource's prefix, such as an order
|
|
93
|
+
# file's order_id, on each record rather than with the collection's
|
|
94
|
+
# params, so another page of a nested list would otherwise lose its path.
|
|
95
|
+
def page_params(params)
|
|
96
|
+
record = first
|
|
97
|
+
return params unless record.respond_to?(:prefix_options)
|
|
98
|
+
|
|
99
|
+
record.prefix_options.merge(params)
|
|
100
|
+
end
|
|
89
101
|
end
|
|
90
102
|
end
|
|
91
103
|
end
|
|
@@ -19,7 +19,7 @@ module Fixably
|
|
|
19
19
|
class << self
|
|
20
20
|
def site
|
|
21
21
|
self.site = site_url unless _site_defined?
|
|
22
|
-
super
|
|
22
|
+
super
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
protected
|
|
@@ -41,7 +41,7 @@ module Fixably
|
|
|
41
41
|
end
|
|
42
42
|
|
|
43
43
|
def initialize(attributes = {}, persisted = false) # rubocop:disable Style/OptionalBooleanParameter
|
|
44
|
-
super
|
|
44
|
+
super
|
|
45
45
|
|
|
46
46
|
self.class.site
|
|
47
47
|
end
|
|
@@ -3,14 +3,13 @@
|
|
|
3
3
|
module Fixably
|
|
4
4
|
module LoadFromResponse
|
|
5
5
|
# Fixably returns collections as hashes which confuses Active Resource
|
|
6
|
-
# rubocop:disable Style/OptionalBooleanParameter
|
|
6
|
+
# rubocop:disable-next Style/OptionalBooleanParameter
|
|
7
7
|
def load(attributes, remove_root = false, persisted = false)
|
|
8
|
-
super
|
|
8
|
+
super
|
|
9
9
|
load_nested_paginated_collections
|
|
10
10
|
remove_empty_associations
|
|
11
11
|
self
|
|
12
12
|
end
|
|
13
|
-
# rubocop:enable Style/OptionalBooleanParameter
|
|
14
13
|
|
|
15
14
|
protected
|
|
16
15
|
|
|
@@ -57,6 +57,14 @@ module Fixably
|
|
|
57
57
|
end
|
|
58
58
|
end
|
|
59
59
|
|
|
60
|
+
# Fixably lists a file only under its order, and leaves quarantined files
|
|
61
|
+
# out. Each file's url is a download link that lasts an hour.
|
|
62
|
+
class File < ApplicationResource
|
|
63
|
+
actions :list
|
|
64
|
+
|
|
65
|
+
has_one :created_by, class_name: "fixably/user"
|
|
66
|
+
end
|
|
67
|
+
|
|
60
68
|
class Line < ApplicationResource
|
|
61
69
|
actions %i[list show]
|
|
62
70
|
end
|
data/lib/fixably/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fixably
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.8.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Adam Rice
|
|
@@ -181,6 +181,7 @@ files:
|
|
|
181
181
|
- docs/device.md
|
|
182
182
|
- docs/location.md
|
|
183
183
|
- docs/order.md
|
|
184
|
+
- docs/order/file.md
|
|
184
185
|
- docs/order/line.md
|
|
185
186
|
- docs/order/note.md
|
|
186
187
|
- docs/order/task.md
|
|
@@ -231,7 +232,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
231
232
|
- !ruby/object:Gem::Version
|
|
232
233
|
version: '0'
|
|
233
234
|
requirements: []
|
|
234
|
-
rubygems_version: 4.0.
|
|
235
|
+
rubygems_version: 4.0.20
|
|
235
236
|
specification_version: 4
|
|
236
237
|
summary: Ruby client for the Fixably API
|
|
237
238
|
test_files: []
|