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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4adb6e9f822e52cf8dd344055878f56a44df8c8e26ef3b6eb615881b45765641
4
- data.tar.gz: 6beb3aad60d5eb8ad8c4d53e2c874a7550bfdcea39d1ad10f8ed35cd596e6ad5
3
+ metadata.gz: 9b0169e30863c4a16ea54283342c20d92bf0364c5cf5fffb373f9b74433aaf43
4
+ data.tar.gz: cfeb515423c5c1f2b15f13ea8e0481150a05e55f56766e0d0f7e28de05fa9acf
5
5
  SHA512:
6
- metadata.gz: 256864970168a48fe41fcd1cdb967fe1917df4541b0e70c4f967c5c3bab69e8c80f64c9851d909d93de95cd0052983d200668643440990dc9262560f1ae648c9
7
- data.tar.gz: ac7a96b0a4d72d62c9cb55329144861a2b683772ca10bd352c50ec9c6d70356a6b554643190d78301441c317964d907d76dba8770002216fbeb5268771e05ed9
6
+ metadata.gz: fca3f233e8e8b9d848183c3bb4c1fe47ec12cbfc95080353c424aa67f848a9e7b1c211803473b3240510e256160d18303d5ad06f5825c7cfa5b08b967a2f384e
7
+ data.tar.gz: 392ebc34af2148c8c04bdbc147f8d6229c312c3a7caf763c224e7684dddb989b221e46506d115dd98c5e10910e2b7b6d3c3efcda0511fc484a75104dc3d23997
@@ -6,13 +6,14 @@ jobs:
6
6
  build:
7
7
  runs-on: ubuntu-latest
8
8
  steps:
9
- - uses: actions/checkout@v2
9
+ - uses: actions/checkout@v4
10
10
  - name: Set up Ruby
11
11
  uses: ruby/setup-ruby@v1
12
12
  with:
13
- ruby-version: 3.0.0
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
- require:
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
- IgnoredPatterns:
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/FilePath:
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
@@ -15,7 +15,7 @@ gemspec
15
15
  if Bundler.settings["gem.mutant.dev"]
16
16
  group :development do
17
17
  source "https://gem.mutant.dev" do
18
- gem "mutant-license"
18
+ gem "mutant-license" # rubocop:disable Gemspec/DevelopmentDependencies
19
19
  end
20
20
  end
21
21
  end
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fixably (0.7.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.2)
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.5.0)
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.11.2)
60
- diff-lcs (~> 1.3)
61
- parser (~> 3.0.0)
62
- regexp_parser (~> 2.0, >= 2.0.3)
63
- sorbet-runtime (~> 0.5.0)
64
- unparser (~> 0.6.2)
65
- mutant-rspec (0.11.2)
66
- mutant (= 0.11.2)
67
- rspec-core (>= 3.8.0, < 4.0.0)
68
- parallel (1.21.0)
69
- parser (3.0.3.2)
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
- regexp_parser (2.2.0)
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.24.1)
99
- parallel (~> 1.10)
100
- parser (>= 3.0.0.0)
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 (>= 1.8, < 3.0)
103
- rexml
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 (>= 1.4.0, < 3.0)
107
- rubocop-ast (1.15.1)
108
- parser (>= 3.0.1.1)
109
- rubocop-performance (1.13.2)
110
- rubocop (>= 1.7.0, < 2.0)
111
- rubocop-ast (>= 0.4.0)
112
- rubocop-rake (0.6.0)
113
- rubocop (~> 1.0)
114
- rubocop-rspec (2.7.0)
115
- rubocop (~> 1.19)
116
- ruby-progressbar (1.11.0)
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.5.9531)
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 (2.1.0)
122
- unparser (0.6.2)
123
- diff-lcs (~> 1.3)
124
- parser (>= 3.0.0)
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))
@@ -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
@@ -35,17 +35,17 @@ module Fixably
35
35
 
36
36
  def create(attributes = {})
37
37
  ActionPolicy.new(resource: self).create!
38
- super(attributes)
38
+ super
39
39
  end
40
40
 
41
41
  def create!(attributes = {})
42
42
  ActionPolicy.new(resource: self).create!
43
- super(attributes)
43
+ super
44
44
  end
45
45
 
46
46
  def delete(id, options = {})
47
47
  ActionPolicy.new(resource: self).delete!
48
- super(id, options)
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
@@ -25,7 +25,7 @@ module ActiveResource
25
25
  end
26
26
 
27
27
  f = filters(options)
28
- opts[:q] = f.join(",") unless f.count.zero?
28
+ opts[:q] = f.join(",") unless f.empty?
29
29
 
30
30
  original_query_string(opts)
31
31
  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(attributes, persisted)
44
+ super
45
45
 
46
46
  self.class.site
47
47
  end
@@ -3,7 +3,7 @@
3
3
  module Fixably
4
4
  module Authorization
5
5
  def headers
6
- result = super()
6
+ result = super
7
7
  result["Authorization"] = api_key
8
8
  result
9
9
  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(attributes, remove_root, persisted)
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
 
@@ -29,7 +29,7 @@ module Fixably
29
29
  errors.add(:base, "Either email or phone must be present")
30
30
  end
31
31
 
32
- def remove_on_encode = super().concat(%w[tags])
32
+ def remove_on_encode = super.push("tags")
33
33
 
34
34
  class ShippingAddress < ApplicationResource
35
35
  schema do
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Fixably
4
- VERSION = "0.7.0"
4
+ VERSION = "0.8.0"
5
5
  end
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.7.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.16
235
+ rubygems_version: 4.0.20
235
236
  specification_version: 4
236
237
  summary: Ruby client for the Fixably API
237
238
  test_files: []