brightpearl_api 0.9.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ff4686309920011a0c2c538f4b2c8611aaffa45
|
4
|
+
data.tar.gz: 466e2b71352e5d61b453b65933bc26551197685d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b71f0f729cb477c6aec02f4aa3ac7b4dbc14229cecf5db5555e61a7077cd821a17e43e94cc2eccdc7c0b0eab1d9f1291006783540e7755dc40e81e69a2ec464
|
7
|
+
data.tar.gz: 4e1406fdd7c3a9dea63f73ba37014d8d05a09968b6d8dcfc735985e3d31846433a3dbb34fed963141aed77ec7a12766832a39afc0a056e478bb6845957b8181e
|
data/README.md
CHANGED
@@ -57,7 +57,7 @@ __All Post calls have to be passed a block which constructs a body hash__
|
|
57
57
|
|
58
58
|
#### Multi Purpose
|
59
59
|
|
60
|
-
*
|
60
|
+
*Five functions (get_resource, create_resource, update_resource, delete_resource, search_resource) take the service name and resource name as parameters. get_resource also takes an optional idset parameter which can be an int, range or array. It'll try to get all resources if idset is not provided and the API supports it.*
|
61
61
|
|
62
62
|
*Range URI's can be retrived via get_resource_range which also takes an optional range*
|
63
63
|
|
@@ -156,6 +156,13 @@ end
|
|
156
156
|
s.get_resource_range('contact', 'contact', 100..200)
|
157
157
|
s.get_resource_range('order', 'order')
|
158
158
|
|
159
|
+
s.search_resource('contact','contact') do |body|
|
160
|
+
hash = {
|
161
|
+
allEmail: 'me@example.com'
|
162
|
+
}
|
163
|
+
body.merge!(hash)
|
164
|
+
end
|
165
|
+
|
159
166
|
```
|
160
167
|
|
161
168
|
#### Supported Service - Resource Pairs
|
@@ -64,5 +64,21 @@ module BrightpearlApi
|
|
64
64
|
call(:options, "/#{service}-service/#{resource}")
|
65
65
|
end
|
66
66
|
end
|
67
|
+
|
68
|
+
def search_resource(service, resource)
|
69
|
+
body = {}
|
70
|
+
yield(body)
|
71
|
+
result_hash = []
|
72
|
+
response = call(:get, "/#{service}/#{resource}-search?#{body.to_query}")
|
73
|
+
properties = response['metaData']['columns'].map { |x| x['name'] }
|
74
|
+
response['results'].each do |result|
|
75
|
+
hash = {}
|
76
|
+
properties.each_with_index do |item, index|
|
77
|
+
hash[item] = result[index]
|
78
|
+
end
|
79
|
+
result_hash << hash
|
80
|
+
end
|
81
|
+
result_hash
|
82
|
+
end
|
67
83
|
end
|
68
84
|
end
|
@@ -3,10 +3,6 @@ module BrightpearlApi
|
|
3
3
|
module Contact
|
4
4
|
def self.included(klass)
|
5
5
|
klass.class_eval do
|
6
|
-
def contact_search
|
7
|
-
# TODO
|
8
|
-
end
|
9
|
-
|
10
6
|
def associate_tag(idset, tag_id)
|
11
7
|
id_set = parse_idset(idset)
|
12
8
|
call(:post, "/contact-service/contact/#{id_set}/tag/#{tag_id.to_int}")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brightpearl_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kunwar Aditya Raghuwanshi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|