fixably 0.1.0 → 0.5.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/Gemfile.lock +1 -1
- data/README.md +1 -0
- data/docs/customer/child.md +1 -1
- data/docs/location.md +33 -0
- data/docs/order/line.md +4 -4
- data/docs/order/note.md +11 -4
- data/docs/order/task.md +4 -4
- data/docs/order.md +7 -1
- data/lib/fixably/argument_parameterisation.rb +3 -2
- data/lib/fixably/encoding.rb +2 -2
- data/lib/fixably/resources/location.rb +10 -0
- data/lib/fixably/resources/order.rb +13 -9
- data/lib/fixably/version.rb +1 -1
- data/lib/fixably.rb +1 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9d5277a0ba5d3af5ae44a46535773a0d37abced3961e2dec3b43b04fe7d31e3
|
4
|
+
data.tar.gz: e3fd8a7cfa9ce0ac0702301bacce2423e8654970afab2cdf4aeeb6f3629a009a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0941d4b684ab7e4dc37a1f930207e8cd9a922779ed0371f51e07a518c594e9fc33320d917bf24bd99b968e4e9e33c83388fc06c85c4b7ebb26c7cad516296467'
|
7
|
+
data.tar.gz: 2f74f0fd34354408ada06e2a5442f75fa1dd4c83b805c021a90292414a49c617166cfd99640b9c8f3f1a07a1e57089547f2e107d0a918e227b1efee99cf0b332
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -116,6 +116,7 @@ Currently supported resources:
|
|
116
116
|
- Fixably::Customer ([documentation](docs/customer.md))
|
117
117
|
- Fixably::Customer::Child ([documentation](docs/customer/child.md))
|
118
118
|
- Fixably::Device ([documentation](docs/device.md))
|
119
|
+
- Fixably::Location ([documentation](docs/location.md))
|
119
120
|
- Fixably::Order ([documentation](docs/order.md))
|
120
121
|
- Fixably::Order::Line ([documentation](docs/order/line.md))
|
121
122
|
- Fixably::Order::Note ([documentation](docs/order/note.md))
|
data/docs/customer/child.md
CHANGED
data/docs/location.md
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# Fixably::Location
|
2
|
+
|
3
|
+
## List location
|
4
|
+
|
5
|
+
```ruby
|
6
|
+
Fixably::Location.all
|
7
|
+
Fixably::Location.where(name: "Our location")
|
8
|
+
```
|
9
|
+
|
10
|
+
### Include associations in a list
|
11
|
+
|
12
|
+
**Deliveries**
|
13
|
+
Currently not implemented
|
14
|
+
|
15
|
+
## Get a location
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
Fixably::Location.find(1_000)
|
19
|
+
Fixably::Location.first
|
20
|
+
Fixably::Location.last
|
21
|
+
```
|
22
|
+
|
23
|
+
## Create a location
|
24
|
+
|
25
|
+
The Fixably API does not allow locations to be created
|
26
|
+
|
27
|
+
## Update a location
|
28
|
+
|
29
|
+
The Fixably API does not allow locations to be updated
|
30
|
+
|
31
|
+
## Destroy a location
|
32
|
+
|
33
|
+
The Fixably API does not allow locations to be destroyed
|
data/docs/order/line.md
CHANGED
@@ -3,15 +3,15 @@
|
|
3
3
|
## List order lines
|
4
4
|
|
5
5
|
```ruby
|
6
|
-
Fixably::Order::Line.all(order_id:
|
6
|
+
Fixably::Order::Line.all(order_id: 1_000)
|
7
7
|
```
|
8
8
|
|
9
9
|
## Get an order line
|
10
10
|
|
11
11
|
```ruby
|
12
|
-
Fixably::Order::Line.find(
|
13
|
-
Fixably::Order::Line.first(order_id:
|
14
|
-
Fixably::Order::Line.last(order_id:
|
12
|
+
Fixably::Order::Line.find(1_000, order_id: 1_000)
|
13
|
+
Fixably::Order::Line.first(order_id: 1_000)
|
14
|
+
Fixably::Order::Line.last(order_id: 1_000)
|
15
15
|
```
|
16
16
|
|
17
17
|
## Create an order line
|
data/docs/order/note.md
CHANGED
@@ -3,15 +3,22 @@
|
|
3
3
|
## List order notes
|
4
4
|
|
5
5
|
```ruby
|
6
|
-
Fixably::Order::Note.all(order_id:
|
6
|
+
Fixably::Order::Note.all(order_id: 1_000)
|
7
|
+
```
|
8
|
+
|
9
|
+
### Include associations in a list
|
10
|
+
|
11
|
+
**Created by**
|
12
|
+
```ruby
|
13
|
+
Fixably::Order.includes(:created_by).all(order_id: 1_000)
|
7
14
|
```
|
8
15
|
|
9
16
|
## Get an order note
|
10
17
|
|
11
18
|
```ruby
|
12
|
-
Fixably::Order::Note.find(
|
13
|
-
Fixably::Order::Note.first(order_id:
|
14
|
-
Fixably::Order::Note.last(order_id:
|
19
|
+
Fixably::Order::Note.find(1_000, order_id: 1_000)
|
20
|
+
Fixably::Order::Note.first(order_id: 1_000)
|
21
|
+
Fixably::Order::Note.last(order_id: 1_000)
|
15
22
|
```
|
16
23
|
|
17
24
|
## Create an order note
|
data/docs/order/task.md
CHANGED
@@ -3,15 +3,15 @@
|
|
3
3
|
## List order tasks
|
4
4
|
|
5
5
|
```ruby
|
6
|
-
Fixably::Order::Task.all(order_id:
|
6
|
+
Fixably::Order::Task.all(order_id: 1_000)
|
7
7
|
```
|
8
8
|
|
9
9
|
## Get an order task
|
10
10
|
|
11
11
|
```ruby
|
12
|
-
Fixably::Order::Task.find(
|
13
|
-
Fixably::Order::Task.first(order_id:
|
14
|
-
Fixably::Order::Task.last(order_id:
|
12
|
+
Fixably::Order::Task.find(1_000, order_id: 1_000)
|
13
|
+
Fixably::Order::Task.first(order_id: 1_000)
|
14
|
+
Fixably::Order::Task.last(order_id: 1_000)
|
15
15
|
```
|
16
16
|
|
17
17
|
## Create an order task
|
data/docs/order.md
CHANGED
@@ -37,6 +37,12 @@ Fixably::Order.includes(:handled_by).all
|
|
37
37
|
Fixably::Order.includes(:handled_by).where(internal_location: "SERVICE")
|
38
38
|
```
|
39
39
|
|
40
|
+
**Location**
|
41
|
+
```ruby
|
42
|
+
Fixably::Order.includes(:location).all
|
43
|
+
Fixably::Order.includes(:location).where(internal_location: "SERVICE")
|
44
|
+
```
|
45
|
+
|
40
46
|
**Ordered by**
|
41
47
|
```ruby
|
42
48
|
Fixably::Order.includes(:ordered_by).all
|
@@ -73,7 +79,7 @@ Fixably::Order.includes(:tasks).all
|
|
73
79
|
Fixably::Order.includes(:tasks).where(internal_location: "SERVICE")
|
74
80
|
```
|
75
81
|
|
76
|
-
## Get
|
82
|
+
## Get an order
|
77
83
|
|
78
84
|
```ruby
|
79
85
|
Fixably::Order.find(1_000)
|
@@ -33,12 +33,13 @@ module Fixably
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def expand_association(association)
|
36
|
+
association_name = association.to_s.camelize(:lower)
|
36
37
|
relationship = reflections.fetch(association).macro
|
37
38
|
case relationship
|
38
39
|
when :has_one
|
39
|
-
|
40
|
+
association_name
|
40
41
|
when :has_many
|
41
|
-
"#{
|
42
|
+
"#{association_name}(items)"
|
42
43
|
else
|
43
44
|
raise ArgumentError, "Unknown relationship, #{relationship}"
|
44
45
|
end
|
data/lib/fixably/encoding.rb
CHANGED
@@ -17,14 +17,14 @@ module Fixably
|
|
17
17
|
|
18
18
|
def remove_on_encode = %w[created_at href id]
|
19
19
|
|
20
|
-
private
|
21
|
-
|
22
20
|
def remove_has_many_associations(attrs)
|
23
21
|
reflections.select { _2.macro.equal?(:has_many) }.keys.each do
|
24
22
|
attrs.delete(_1)
|
25
23
|
end
|
26
24
|
end
|
27
25
|
|
26
|
+
private
|
27
|
+
|
28
28
|
def remove_unallowed_parameters(attrs)
|
29
29
|
remove_on_encode.each { attrs.delete(_1) }
|
30
30
|
end
|
@@ -14,6 +14,7 @@ module Fixably
|
|
14
14
|
has_one :customer, class_name: "fixably/customer"
|
15
15
|
has_one :device, class_name: "fixably/device"
|
16
16
|
has_one :handled_by, class_name: "fixably/customer"
|
17
|
+
has_one :location, class_name: "fixably/location"
|
17
18
|
has_one :ordered_by, class_name: "fixably/customer"
|
18
19
|
has_one :queue, class_name: "fixably/queue"
|
19
20
|
has_one :status, class_name: "fixably/status"
|
@@ -23,7 +24,6 @@ module Fixably
|
|
23
24
|
has_many :tasks, class_name: "fixably/order/task"
|
24
25
|
|
25
26
|
# TODO
|
26
|
-
# has_one :location
|
27
27
|
# has_one :store
|
28
28
|
|
29
29
|
ALLOWED_INTERNAL_LOCATIONS =
|
@@ -39,6 +39,15 @@ module Fixably
|
|
39
39
|
allow_nil: true
|
40
40
|
)
|
41
41
|
|
42
|
+
protected
|
43
|
+
|
44
|
+
def remove_has_many_associations(attrs)
|
45
|
+
reflections.select { |_, reflection| reflection.macro.equal?(:has_many) }.
|
46
|
+
keys.
|
47
|
+
reject { _1.equal?(:notes) }.
|
48
|
+
each { attrs.delete(_1) }
|
49
|
+
end
|
50
|
+
|
42
51
|
class Contact < ApplicationResource
|
43
52
|
schema do
|
44
53
|
string :full_name
|
@@ -71,17 +80,12 @@ module Fixably
|
|
71
80
|
string :text
|
72
81
|
string :type
|
73
82
|
end
|
83
|
+
|
84
|
+
has_one :created_by, class_name: "fixably/user"
|
74
85
|
end
|
75
86
|
|
76
87
|
class Task < ApplicationResource
|
77
|
-
actions %i[list show
|
78
|
-
|
79
|
-
# TODO
|
80
|
-
# has_one :task
|
81
|
-
|
82
|
-
def update
|
83
|
-
raise "Updating order tasks has not been implemented"
|
84
|
-
end
|
88
|
+
actions %i[list show]
|
85
89
|
end
|
86
90
|
end
|
87
91
|
end
|
data/lib/fixably/version.rb
CHANGED
data/lib/fixably.rb
CHANGED
@@ -11,6 +11,7 @@ require "fixably/version"
|
|
11
11
|
require_relative "fixably/application_resource"
|
12
12
|
require_relative "fixably/resources/customer"
|
13
13
|
require_relative "fixably/resources/device"
|
14
|
+
require_relative "fixably/resources/location"
|
14
15
|
require_relative "fixably/resources/order"
|
15
16
|
require_relative "fixably/resources/queue"
|
16
17
|
require_relative "fixably/resources/status"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fixably
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Rice
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activeresource
|
@@ -160,6 +160,7 @@ files:
|
|
160
160
|
- docs/customer.md
|
161
161
|
- docs/customer/child.md
|
162
162
|
- docs/device.md
|
163
|
+
- docs/location.md
|
163
164
|
- docs/order.md
|
164
165
|
- docs/order/line.md
|
165
166
|
- docs/order/note.md
|
@@ -184,6 +185,7 @@ files:
|
|
184
185
|
- lib/fixably/resource_lazy_loader.rb
|
185
186
|
- lib/fixably/resources/customer.rb
|
186
187
|
- lib/fixably/resources/device.rb
|
188
|
+
- lib/fixably/resources/location.rb
|
187
189
|
- lib/fixably/resources/order.rb
|
188
190
|
- lib/fixably/resources/queue.rb
|
189
191
|
- lib/fixably/resources/status.rb
|