okapi 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -26,7 +26,7 @@ module Apiary
26
26
  def read_file(path)
27
27
  @data = []
28
28
  File.open(path).each do |line|
29
- @data << line
29
+ @data << line if line.strip != ""
30
30
  end
31
31
  @data
32
32
  end
@@ -34,8 +34,9 @@ module Apiary
34
34
  def parse_data
35
35
  @data.each { |res|
36
36
  splited = res.split(' ',3)
37
+
37
38
  begin
38
- splited[2] = JSON.parse splited[2] if splited[2]
39
+ splited[2] = JSON.parse splited[2] if splited[2] and splited[2] != ''
39
40
  rescue Exception => e
40
41
  raise Exception, 'can not parse parameters for resource:' + res + "(#{e})"
41
42
  end
data/lib/okapi/test.rb CHANGED
@@ -51,7 +51,7 @@ module Apiary
51
51
 
52
52
  data = get_requests_spec(resources)
53
53
 
54
- raise Exception, 'Can not get request data from apiary ' + data[:error] || '' if data[:error] or data[:resp].code.to_i != 200
54
+ raise Exception, 'Can not get request data from Apiary: ' + data[:error] || '' if data[:error] or data[:resp].code.to_i != 200
55
55
 
56
56
  data[:data].each do |res|
57
57
  raise Exception, 'Resource error "' + res['error'] + '" for resource "' + res["method"] + ' ' + res["uri"] + '"' if res['error']
@@ -85,7 +85,7 @@ module Apiary
85
85
 
86
86
  resource.response = Apiary::Okapi::Response.new(response.code, raw_headers, response.body)
87
87
  rescue Exception => e
88
- raise Exception 'Can not get response for:' + params
88
+ raise Exception, 'Can not get response for: ' + params.to_json + ' (' + e.to_s + ')'
89
89
  end
90
90
  }
91
91
 
data/lib/okapi/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  module Apiary
3
3
  module Okapi
4
- VERSION = "0.0.3"
4
+ VERSION = "0.0.4"
5
5
  end
6
6
  end
@@ -1,2 +1,4 @@
1
1
  POST /shopping-cart/{id2} {"id2": "eee2"}
2
- POST /payment
2
+ POST /payment
3
+
4
+
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: okapi
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 3
10
- version: 0.0.3
9
+ - 4
10
+ version: 0.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tu1ly