fmrest 0.14.0 → 0.15.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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/README.md +27 -11
  4. metadata +17 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cebcaeabea056bcedc6e48b911ec3b1941251b7ddfc77e4e4c756fd88c99cdf9
4
- data.tar.gz: 15a9061d6efc330b645d6bf325f52cfc7e550f9b020d954324e3c1fa456c0276
3
+ metadata.gz: 89540bf2ad2452a234fe6d42f1711d46dd3533e667980a050258c95c84c02597
4
+ data.tar.gz: ecbe0af46dcc374411c6d007a463f220a69904a15b0cfbca87160d7204cad9a9
5
5
  SHA512:
6
- metadata.gz: 26685e56f1ad34dadbd5d6d7516e692502d7b5184e319bde83b562f713be03ef39ad8637eb967b2e83c7622c81434c91671f59e7ebc314331d44a67117080a6b
7
- data.tar.gz: 4903de48f1ec3e1d7939ee689298083c09b89c49dbf7c1e27032b3986993021791977bff2d34cf1d13dc408e358a860e6bd65c0fbebf29fb2cda42d4251dae6a
6
+ metadata.gz: fd7765bc8695fe8b63393965b807d1828ecad81d995f82987e8e36579092f7442b3f31b7a6948c423915eb51d27c7cd83f4bac6edb7f32dc7107a573cb5e3f24
7
+ data.tar.gz: b515ff6e9ae14c9b5cc69e6ede9e53e32e9580c607feb0bc613ec067b1176c8b4ff9829f564ed622f765c9b02a116eabe9f93aa567b0a6af8f2c320a1e643cd0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  ## Changelog
2
2
 
3
+ ### 0.15.0
4
+
5
+ * Much improved querying API (see documentation on querying), adding new
6
+ `.query` capabilities, as well as two new methods: `.match` and `.or`
7
+
3
8
  ### 0.14.0
4
9
 
5
10
  * Aliased `FmRest::Spyke::Base` as `FmRest::Layout` (now preferred), and
data/README.md CHANGED
@@ -54,13 +54,28 @@ class Honeybee < FmRest::Layout("Honeybees Web")
54
54
  }
55
55
 
56
56
  # Mapped attributes
57
- attributes name: "Bee Name", age: "Bee Age"
57
+ attributes name: "Bee Name", age: "Bee Age", created_on: "Created On"
58
58
 
59
- # Portals
60
- has_portal :flowers
59
+ # Portal associations
60
+ has_portal :tasks
61
61
 
62
- # File container
62
+ # File containers
63
63
  container :photo, field_name: "Bee Photo"
64
+
65
+ # Scopes
66
+ scope :can_legally_fly, -> { query(age: ">18") }
67
+
68
+ # Client-side validations
69
+ validates :name, presence: true
70
+
71
+ # Callbacks
72
+ before_save :set_created_on
73
+
74
+ private
75
+
76
+ def set_created_on
77
+ self.created_on = Date.today
78
+ end
64
79
  end
65
80
 
66
81
  # Find a record by id
@@ -69,7 +84,7 @@ bee = Honeybee.find(9)
69
84
  bee.name = "Hutch"
70
85
 
71
86
  # Add a new record to portal
72
- bee.flowers.build(name: "Daisy")
87
+ bee.tasks.build(urgency: "Today")
73
88
 
74
89
  bee.save
75
90
  ```
@@ -129,9 +144,9 @@ You can also pass a `:log` option for basic request logging, see the section on
129
144
  Option | Description | Format | Default
130
145
  --------------------|--------------------------------------------|-----------------------------|--------
131
146
  `:host` | Hostname with optional port, e.g. `"example.com:9000"` | String | None
132
- `:database` | | String | None
133
- `:username` | | String | None
134
- `:password` | | String | None
147
+ `:database` | The name of the database to connect to | String | None
148
+ `:username` | A Data API-ready account | String | None
149
+ `:password` | Your password | String | None
135
150
  `:account_name` | Alias of `:username` | String | None
136
151
  `:ssl` | SSL options to be forwarded to Faraday | Faraday SSL options | None
137
152
  `:proxy` | Proxy options to be forwarded to Faraday | Faraday proxy options | None
@@ -288,7 +303,8 @@ class Honeybee < FmRest::Layout
288
303
  end
289
304
  ```
290
305
 
291
- Alternatively, you can set the layout name in the class definition line:
306
+ Alternatively, if you're inheriting from `FmRest::Layout` directly you can set
307
+ the layout name in the class definition line:
292
308
 
293
309
  ```ruby
294
310
  class Honeybee < FmRest::Layout("Honeybees Web")
@@ -388,8 +404,8 @@ Guides](https://guides.rubyonrails.org/active_model_basics.html#dirty).
388
404
  Since Spyke is API-agnostic it only provides a wide-purpose `.where` method for
389
405
  passing arbitrary parameters to the REST backend. fmrest-ruby however is well
390
406
  aware of its backend API, so it extends Spkye models with a bunch of useful
391
- querying methods: `.query`, `.limit`, `.offset`, `.sort`, `.portal`, `.script`,
392
- etc.
407
+ querying methods: `.query`, `.match`, `.omit`, `.limit`, `.offset`, `.sort`,
408
+ `.portal`, `.script`, etc.
393
409
 
394
410
  See the [main document on querying](docs/Querying.md) for detailed information
395
411
  on the query API methods.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fmrest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0
4
+ version: 0.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pedro Carbajal
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-23 00:00:00.000000000 Z
11
+ date: 2021-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fmrest-core
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.14.0
19
+ version: 0.15.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.14.0
26
+ version: 0.15.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: fmrest-spyke
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 0.14.0
33
+ version: 0.15.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 0.14.0
40
+ version: 0.15.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -222,6 +222,17 @@ licenses:
222
222
  - MIT
223
223
  metadata: {}
224
224
  post_install_message: |+
225
+ =======================================
226
+ Notes on upgrading from fmrest < 0.15
227
+ =======================================
228
+
229
+ There's a breaking change in the way the `.query` method behaves when chained.
230
+
231
+ Previously it would add new conditions as a logical OR in relation to
232
+ already set ones, whereas now by default it adds new conditions as a logical
233
+ AND relative to existing ones. To keep the old behavior you can use `.or.query`
234
+ in chained query calls instead. See documentation on querying for details.
235
+
225
236
  =======================================
226
237
  Notes on upgrading from fmrest < 0.13
227
238
  =======================================