magentwo 0.1.84 → 0.1.85
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/adapter.rb +2 -1
- data/lib/filter.rb +1 -1
- data/lib/model/base.rb +5 -2
- data/magentwo.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c389ffd5dfd801c072750c3187115827d82b4a3ff72cd07dcd2dd54729e1d8d5
|
4
|
+
data.tar.gz: 6a72bd03b8e4941e4acbafb446e2618166cbbc9b0e81dc3699f35f3ebfa1266c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba50d3ac4eb38a5058bcbd1dfdbedc540aea54bf125819347b1bdbfa56b97de8425eb1defa7f6a059e78d93498b9d155858bee0634e8ffab6ef399b08362e9f5
|
7
|
+
data.tar.gz: 6b911f6f943d9dfb7eeee47a2fd7f9d51fc2262968dc7b92769e1e1e20d6fb50462428e14d902300f98de9ba9c8519ef12ee859b2509a7650d9bcfb021f5067b
|
data/lib/adapter.rb
CHANGED
data/lib/filter.rb
CHANGED
@@ -21,7 +21,7 @@ module Magentwo
|
|
21
21
|
end
|
22
22
|
|
23
23
|
class CompareArray < Compare
|
24
|
-
def to_query
|
24
|
+
def to_query idx
|
25
25
|
[
|
26
26
|
"searchCriteria[filter_groups][#{idx}][filters][0][field]=#{self.field}",
|
27
27
|
"searchCriteria[filter_groups][#{idx}][filters][0][value]=#{URI::encode(self.value.map(&:to_s).join(","))}",
|
data/lib/model/base.rb
CHANGED
@@ -65,7 +65,8 @@ module Magentwo
|
|
65
65
|
attr_accessor :adapter
|
66
66
|
|
67
67
|
def [] unique_identifier_value
|
68
|
-
|
68
|
+
result = Magentwo::Base.get nil, path:"#{base_path}/#{unique_identifier_value}"
|
69
|
+
self.new result if result
|
69
70
|
end
|
70
71
|
|
71
72
|
def unique_identifier
|
@@ -87,6 +88,7 @@ module Magentwo
|
|
87
88
|
|
88
89
|
def all ds=self.dataset, meta_data:false
|
89
90
|
response = self.get(ds.to_query, :meta_data => meta_data)
|
91
|
+
return [] if response.nil?
|
90
92
|
items = (meta_data ? response[:items] : response)
|
91
93
|
.map do |item|
|
92
94
|
self.new item
|
@@ -100,7 +102,8 @@ module Magentwo
|
|
100
102
|
end
|
101
103
|
|
102
104
|
def first ds=self.dataset
|
103
|
-
|
105
|
+
response = self.get(ds.page(1, 1).to_query).first
|
106
|
+
self.new response if response
|
104
107
|
end
|
105
108
|
|
106
109
|
def each_page page_size=Magentwo.default_page_size, &block
|
data/magentwo.gemspec
CHANGED