osc_ruby 0.1.9 → 0.1.10

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: 147fb6cc739484cf85fab9b8b43f6ab197eeb240
4
- data.tar.gz: afd7a03fc798c644d2d275a6e285528a32c01746
3
+ metadata.gz: ca63de8b887f3fd7a4f053fa2169013a9ec0121a
4
+ data.tar.gz: d51fe8fd736021ed2bcd74cf68b758e92ba0f25e
5
5
  SHA512:
6
- metadata.gz: 632fa408fe9ac6b9e7eac7521caceeed202b594f5f0d06607dbebf7c62b688eb98f4fb98b3351d38f583d52dc8773b77b4e63a3ab58bb57aba3c07fd8d4a331f
7
- data.tar.gz: 2906a3b6b5a8208ed770aa9e4e3e010304226605058f7c3f2e6429f760a48a8e52a6701b74b81ff545a2feea5f99c7d806cb4855a88f050c396c7cfcf604b311
6
+ metadata.gz: c907042c7cbad989ae25e304bfc85182b92295fd55c07eeb3159ff1af9695f93577383c68c27dd0a693bfb28b609e388b60efd805aaab044100d627fa50d7f41
7
+ data.tar.gz: e6340ed3dc8cf652e92cbfcac44abc7b184ef42c509e22c2f39c19144e6d358f04ebba1d8e6815348aca1a285313db841e54e0bdfa254b97e036c27501ebe757
@@ -87,7 +87,7 @@ module OSCRuby
87
87
 
88
88
  end
89
89
 
90
- def self.find(client,id = nil)
90
+ def self.find(client,id = nil,return_json = false)
91
91
 
92
92
  check_client(client)
93
93
 
@@ -101,23 +101,39 @@ module OSCRuby
101
101
 
102
102
  service_product_json = QueryModule::find(client,resource)
103
103
 
104
- service_product_json_final = JSON.parse(service_product_json)
104
+ if return_json == true
105
105
 
106
- new_from_fetch(service_product_json_final[0])
106
+ service_product_json
107
+
108
+ else
109
+
110
+ service_product_json_final = JSON.parse(service_product_json)
111
+
112
+ new_from_fetch(service_product_json_final[0])
113
+
114
+ end
107
115
 
108
116
  end
109
117
 
110
- # def self.all(client)
118
+ def self.all(client, return_json = false)
111
119
 
112
- # resource = URI.escape("queryResults/?query=select * from serviceproducts")
120
+ resource = URI.escape("queryResults/?query=select * from serviceproducts")
113
121
 
114
- # service_product_json = QueryModule::find(client,resource)
122
+ service_product_json = QueryModule::find(client,resource)
115
123
 
116
- # service_product_json_final = JSON.parse(service_product_json)
124
+ if return_json == true
117
125
 
118
- # service_product_json_final.map { |attributes| new_from_fetch(attributes) }
126
+ service_product_json
119
127
 
120
- # end
128
+ else
129
+
130
+ service_product_json_final = JSON.parse(service_product_json)
131
+
132
+ service_product_json_final.map { |attributes| new_from_fetch(attributes) }
133
+
134
+ end
135
+
136
+ end
121
137
 
122
138
  def self.new_from_fetch(attributes)
123
139
 
@@ -1,3 +1,3 @@
1
1
  module OSCRuby
2
- VERSION = "0.1.9"
2
+ VERSION = "0.1.10"
3
3
  end
@@ -210,7 +210,7 @@ describe OSCRuby::ServiceProduct do
210
210
  OSCRuby::ServiceProduct.find(client, 100)
211
211
  }
212
212
 
213
- it 'should return an instance of a new OSC::ServiceProduct object with at least a name and displayOrder' do
213
+ it 'should return an instance of a new OSCRuby::ServiceProduct object with at least a name and displayOrder' do
214
214
 
215
215
  expect(known_working_product).to be_an(OSCRuby::ServiceProduct)
216
216
 
@@ -220,6 +220,48 @@ describe OSCRuby::ServiceProduct do
220
220
 
221
221
  end
222
222
 
223
+ it 'should return the raw json response if the return_json parameter is set to true' do
224
+
225
+ known_working_product_in_json = OSCRuby::ServiceProduct.find(client, 100, true)
226
+
227
+ expect(known_working_product_in_json).to be_an(String)
228
+
229
+ end
230
+
231
+ end
232
+
233
+ context '#all' do
234
+
235
+ it 'should return multiple instances of OSCRuby::ServiceProduct' do
236
+
237
+ products = OSCRuby::ServiceProduct.all(client)
238
+
239
+ expect(products.size).to be > 0
240
+
241
+ puts "Checking if OSCRuby::ServiceProduct.all produces multiple instances of products"
242
+
243
+ products.each_with_index do |p,i|
244
+
245
+ if i < 10
246
+
247
+ expect(p).to be_an(OSCRuby::ServiceProduct)
248
+
249
+ end
250
+
251
+ end
252
+
253
+ end
254
+
255
+ it 'should just return JSON if the return_json parameter is set to true' do
256
+
257
+ expect(OSCRuby::ServiceProduct.all(client,true)).to be_a(String)
258
+
259
+ end
260
+
261
+ end
262
+
263
+ contect '#where' do
264
+
223
265
  end
224
266
 
225
267
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: osc_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rajan Davis