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: f410dbbc703592d57a6682f4f9f4c82a6b77314a
4
- data.tar.gz: afa11400aff3eb3861ae03852e663528af910c45
3
+ metadata.gz: 4ff4686309920011a0c2c538f4b2c8611aaffa45
4
+ data.tar.gz: 466e2b71352e5d61b453b65933bc26551197685d
5
5
  SHA512:
6
- metadata.gz: 984c93efc23fd0e2466d38a0f6c6f7118650704cad0fc3efc4e063d1264c3ee36942fe82484fb5568a2ad65fed3d9c58f3d5b1ee988a4367d03b64e3c0afc744
7
- data.tar.gz: f3d290f29838ac2155065f1c99148c912356c9bad8e748b46c402d1c1ee9580c66fcec063ec06039b2536b1146b01b0fb196763cd5b6cea633453752db906d39
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
- *Four functions (get_resource, create_resource, update_resource, delete_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.*
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}")
@@ -3,10 +3,6 @@ module BrightpearlApi
3
3
  module Order
4
4
  def self.included(klass)
5
5
  klass.class_eval do
6
- def order_search
7
- # TODO
8
- end
9
-
10
6
  def order_acknowledgement(order_id, reference)
11
7
  body = {
12
8
  reference: "#{reference}"
@@ -31,10 +31,6 @@ module BrightpearlApi
31
31
  call(:post, "/product-service/option/#{option_id.to_int}/value", body)
32
32
  end
33
33
 
34
- def product_search
35
- # TODO
36
- end
37
-
38
34
  def update_product_price(product_id)
39
35
  body = {}
40
36
  yield(body)
@@ -1,3 +1,3 @@
1
1
  module BrightpearlApi
2
- VERSION = "0.9.0"
2
+ VERSION = "1.0.0"
3
3
  end
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.9.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-13 00:00:00.000000000 Z
11
+ date: 2014-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler