konduto-ruby 1.0.0 → 1.0.1

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: 79d4e5bd7ec52ea368972d4faf1d8a58bf9cd23a
4
- data.tar.gz: 0778688a51fb6b89b455eb758d4be0e92d54df05
3
+ metadata.gz: 1712725ba75c88c304f9e47413c346a943e2f749
4
+ data.tar.gz: 131057d7bb022aa91f5f1f76b9822822fee54ed9
5
5
  SHA512:
6
- metadata.gz: 022d0cb281e28294a6605b6609f0cf6d5a453574d8ac0c2e5d8cc0c4c7c4dbc6cd8d6c95a5ce72b0b770330e1db0b4f0e6c098187d1c5021859f7c3d11ec9961
7
- data.tar.gz: ef1fde2699e3cd12b87ef6b9b2ff30745b0334ce3e3d5c4f7d9634c74ced98e07a15d909e8119fd161284cfa6213e0bf9c06c9529b8673bf6bc0270eaca14fd6
6
+ metadata.gz: 1d2a9456d560bc89b481a401859dd8a0e9e92445d7e7f999f79070e7e102333d5cf6c1a3c320f30e849d52a430fdf5269ea63f2d76782bd71388f0f304abed3a
7
+ data.tar.gz: a9144388a3848ae0ef7031362d5a149f078e487757227dc32933a55d336345f588131750d32a8ad90c320a27ee911db774f4e613eafa2a8c7de98dcb7a3c2408
data/lib/konduto-ruby.rb CHANGED
@@ -2,7 +2,7 @@ class KondutoRuby
2
2
  require 'uri'
3
3
  require 'base64'
4
4
  require 'net/http'
5
- require 'konduto-ruby/konduto_order_status'
5
+ require 'konduto-ruby/konduto_order'
6
6
  attr_accessor :request_body, :response_body, :endpoint
7
7
  attr_reader :api_key
8
8
 
@@ -63,7 +63,7 @@ class KondutoRuby
63
63
  order.id = order_id unless order.id
64
64
  return order
65
65
  else
66
- raise build_error_message(JSON.parse(response.body)['message'])
66
+ raise (JSON.parse(response.body)['message']).to_s
67
67
  end
68
68
 
69
69
 
@@ -76,7 +76,7 @@ class KondutoRuby
76
76
  if response.kind_of? Net::HTTPSuccess
77
77
  return KondutoOrder.new JSON.parse(response.entity)['order']
78
78
  else
79
- raise build_error_message(JSON.parse(response.body)['message'])
79
+ raise (JSON.parse(response.body)['message']).to_s
80
80
  end
81
81
  end
82
82
 
@@ -94,24 +94,7 @@ class KondutoRuby
94
94
  order.status = resposta['new_status']
95
95
  return order
96
96
  else
97
- raise build_error_message(JSON.parse(response.body)['message'])
98
- end
99
- end
100
-
101
- def build_error_message(error)
102
- expected = error['why']['expected']
103
- if expected.is_a?(Array)
104
- expected = ''
105
- expected.each_with_index do |ex,index|
106
- expected += ex
107
- expected += ' - ' unless (index == expected.size - 1)
108
- end
109
- end
110
-
111
- if error['error_identifier'].nil?
112
- return "-> Where: #{error['where']}\n->Expected: #{expected}, Found: #{error['why']['found']}"
113
- else
114
- return "#->{error['error_identifier']} - #{error['notification']} / Where: #{error['where']}\n-> Expected: #{expected}, Found: #{error['why']['found']}"
97
+ raise (JSON.parse(response.body)['message']).to_s
115
98
  end
116
99
  end
117
100
  end
@@ -2,12 +2,16 @@ class KondutoOrder
2
2
  require 'konduto-ruby/konduto_address'
3
3
  require 'konduto-ruby/konduto_customer'
4
4
  require 'konduto-ruby/konduto_device'
5
- require 'konduto-ruby/konduto_navigation'
6
5
  require 'konduto-ruby/konduto_geolocation'
7
- require 'konduto-ruby/konduto_seller'
8
- require 'konduto-ruby/konduto_payment'
9
6
  require 'konduto-ruby/konduto_item'
7
+ require 'konduto-ruby/konduto_loyalty'
8
+ require 'konduto-ruby/konduto_navigation'
9
+ require 'konduto-ruby/konduto_order_status'
10
+ require 'konduto-ruby/konduto_passenger'
11
+ require 'konduto-ruby/konduto_payment'
12
+ require 'konduto-ruby/konduto_seller'
10
13
  require 'konduto-ruby/konduto_travel'
14
+ require 'konduto-ruby/konduto_travel_info'
11
15
  require 'konduto-ruby/konduto_utils'
12
16
  require 'json/pure'
13
17
 
@@ -28,6 +32,7 @@ class KondutoOrder
28
32
  self.travel = KondutoTravel.new
29
33
  self.device = KondutoDevice.new
30
34
  self.geolocation = KondutoGeolocation.new
35
+ self.navigation = KondutoNavigation.new
31
36
  else
32
37
  params = KondutoUtils.deep_symbolize_keys params
33
38
  if params[shipping_address].nil?
@@ -1,5 +1,6 @@
1
1
  class KondutoTravel
2
2
  require 'konduto-ruby/konduto_travel_info'
3
+ require 'konduto-ruby/konduto_passenger'
3
4
  require 'konduto-ruby/konduto_utils'
4
5
  attr_accessor :type, :departure, :return, :passengers
5
6
  TYPE_TRAVEL = [:flight, :bus]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: konduto-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriel Custodio
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-04-29 00:00:00.000000000 Z
12
+ date: 2016-05-13 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: ''
15
15
  email: