elmas 2.0.0 → 2.1.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
  SHA1:
3
- metadata.gz: 4405c4e143b2a041bd2b2bda762788051e196143
4
- data.tar.gz: 79f57ea2506232679f28c47c531041415f823765
3
+ metadata.gz: e421ff5c7b4f08353819e71867737f45ae1174fb
4
+ data.tar.gz: 011198e09daaacb28d7f0549a005a20d455f8259
5
5
  SHA512:
6
- metadata.gz: f2df0a83caef1ff642f07b7afa9fcdb2ae70c7d25f8f848bdcefe0f405d4b7ca0c22b92e9fdb11aa7b9ebc2f424fc75a92cbd709b4ab84e5033fcda54b102963
7
- data.tar.gz: ab9a2b334311157f842e3a62e2effe555df9d1c6a860c38e48244f1a8c50465cf3a8e8c0c1cfa9da3f4b76edec390fce4f478b978a337ea8f02d0684cee719ef
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
@@ -13,7 +13,7 @@ module Elmas
13
13
  end
14
14
 
15
15
  def base_path
16
- "financial/AgingReceivablesLists"
16
+ "read/financial/AgingReceivablesList"
17
17
  end
18
18
 
19
19
  def mandatory_attributes
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
- "#{query_attribute(attribute)} eq #{sanitize_value(value)}"
27
- end
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
@@ -1,7 +1,7 @@
1
1
  module Elmas
2
2
  class Version
3
3
  MAJOR = 2
4
- MINOR = 0
4
+ MINOR = 1
5
5
  PATCH = 0
6
6
 
7
7
  class << self
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.0.0
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: 2015-12-15 00:00:00.000000000 Z
11
+ date: 2016-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday