elmas 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -3
- data/lib/elmas/resources/aging_receivables_list.rb +1 -1
- data/lib/elmas/uri.rb +8 -2
- data/lib/elmas/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e421ff5c7b4f08353819e71867737f45ae1174fb
|
4
|
+
data.tar.gz: 011198e09daaacb28d7f0549a005a20d455f8259
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44eb556375f882d31e23a5a71492edf59f39026a4ba348e3562d4246eef3f1c3f086b838f41b08e74d1ebd503445b199e848f232de8a24bec8b4f24b189b066a
|
7
|
+
data.tar.gz: a544e1cb604941a50e8f23e139d26f0df7540e2816ce19814cd804f3d20114fdabfd7dad2409db3b5ee0bcaeab7cff23a9937118085e96a788278ca6ea969ac8
|
data/README.md
CHANGED
@@ -107,13 +107,11 @@ the `next_page` method.
|
|
107
107
|
accounts.next_page
|
108
108
|
```
|
109
109
|
|
110
|
-
### Filter results
|
110
|
+
### Filter and sort results
|
111
111
|
|
112
112
|
Filtering result sets can be done by adding attributes to the initializer and then
|
113
113
|
using `find_by`. Filters accept a single value or an array of values.
|
114
114
|
|
115
|
-
So far only 'eq' has been implemented, so only direct matches will be returned.
|
116
|
-
|
117
115
|
```ruby
|
118
116
|
# Find the account with code 123
|
119
117
|
accounts = Elmas::Account.new(code: '123').find_by(filter: [:code])
|
@@ -122,6 +120,13 @@ accounts = Elmas::Account.new(code: '123').find_by(filter: [:code])
|
|
122
120
|
accounts = Elmas::Account.new(code: ['123', '345']).find_by(filter: [:code])
|
123
121
|
```
|
124
122
|
|
123
|
+
You can also match on values "greater than" or "less than" by specifying `gt` or `lt`:
|
124
|
+
|
125
|
+
```ruby
|
126
|
+
# Find all AgingReceivables with an amount greater than 0 in the third age range
|
127
|
+
Elmas::AgingReceivablesList.new(age_group3_amount: { gt: 0 }).find_by(filters: [:age_group3_amount])
|
128
|
+
```
|
129
|
+
|
125
130
|
Results can be sorted in the same way
|
126
131
|
|
127
132
|
```ruby
|
data/lib/elmas/uri.rb
CHANGED
@@ -23,8 +23,14 @@ module Elmas
|
|
23
23
|
values = [values] unless values.is_a?(Array)
|
24
24
|
|
25
25
|
filters = values.map do |value|
|
26
|
-
|
27
|
-
|
26
|
+
if value.is_a?(Hash)
|
27
|
+
value.map do |key, val|
|
28
|
+
"#{query_attribute(attribute)} #{key} #{sanitize_value(val)}"
|
29
|
+
end
|
30
|
+
else
|
31
|
+
"#{query_attribute(attribute)} eq #{sanitize_value(value)}"
|
32
|
+
end
|
33
|
+
end.flatten
|
28
34
|
|
29
35
|
["$filter", filters.join(" or ")]
|
30
36
|
end
|
data/lib/elmas/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elmas
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marthyn
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|