routific 0.0.2 → 0.0.3

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/routific.rb +17 -11
  3. metadata +11 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 816c3c547394292568835be244e80f7e3042a2bf
4
- data.tar.gz: 7699025ca637127d31938cf3f0737ff14a881ef7
3
+ metadata.gz: cc6c661a65a9129693f2fd1f1c5fe07d50089e2b
4
+ data.tar.gz: 5ecbf5537ec5bfac22d72aa3bcd7eaddc40165ba
5
5
  SHA512:
6
- metadata.gz: ca55300f37e6c0659b33c89d6bd57eba44b2e80eefc668bad6f1c38bf8817d7ffa144d8f8b99c0598bbb2c61f0ef3699c61b9ebcaa4284cfcbda26b389a1ea88
7
- data.tar.gz: fffe66b45b0f2f52b0c8882f328c7960c6637c5fb963f1d924ef902db9c539e0e4b6b3db2a4725d70407a65b4d8f2dffb044476b57041b3c53d64878cd24d1b7
6
+ metadata.gz: db5d7e8a3108ced87eb681b37ce2c5c3348d776a53fbb5159256b898851e0cbb73b21faaf7c4a5e0cfc4464bfa194a2d36b4b91b47b9ceebfcd7244072a3da4a
7
+ data.tar.gz: d27dec456acf25f6dbd351966c28e9819bb0948dad9c2f7e2d96538794428fb7cac02ba5bf38e75d3e1880f92e8399823c25a3290beac7b2bbe7294d0c097d64
@@ -71,18 +71,24 @@ class Routific
71
71
  end
72
72
 
73
73
  # Sends HTTP request to Routific API server
74
- response = RestClient.post('https://routific.com/api/vrp',
75
- data.to_json,
76
- 'Authorization' => "bearer #{token}",
77
- content_type: :json,
78
- accept: :json
79
- )
74
+ begin
75
+ response = RestClient.post('https://routific.com/api/vrp',
76
+ data.to_json,
77
+ 'Authorization' => "bearer #{token}",
78
+ content_type: :json,
79
+ accept: :json
80
+ )
80
81
 
81
- # Parse the HTTP request response to JSON
82
- jsonResponse = JSON.parse(response)
82
+ # Parse the HTTP request response to JSON
83
+ jsonResponse = JSON.parse(response)
83
84
 
84
- # Parse the JSON representation into a Route object
85
- Route.parse(jsonResponse)
85
+ # Parse the JSON representation into a Route object
86
+ Route.parse(jsonResponse)
87
+ rescue => e
88
+ errorResponse = JSON.parse e.response.body
89
+ puts "Received HTTP #{e.message}: #{errorResponse["error"]}"
90
+ nil
91
+ end
86
92
  end
87
93
  end
88
- end
94
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: routific
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marc Kuo
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-11-18 00:00:00.000000000 Z
12
+ date: 2015-01-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client
@@ -68,47 +68,47 @@ dependencies:
68
68
  - !ruby/object:Gem::Version
69
69
  version: '1.4'
70
70
  - !ruby/object:Gem::Dependency
71
- name: pry
71
+ name: dotenv
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - "~>"
75
75
  - !ruby/object:Gem::Version
76
- version: '0.10'
76
+ version: '0.11'
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
81
  - - "~>"
82
82
  - !ruby/object:Gem::Version
83
- version: '0.10'
83
+ version: '0.11'
84
84
  - !ruby/object:Gem::Dependency
85
- name: pry-debugger
85
+ name: byebug
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
88
  - - "~>"
89
89
  - !ruby/object:Gem::Version
90
- version: '0.2'
90
+ version: '3.5'
91
91
  type: :development
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
95
  - - "~>"
96
96
  - !ruby/object:Gem::Version
97
- version: '0.2'
97
+ version: '3.5'
98
98
  - !ruby/object:Gem::Dependency
99
- name: dotenv
99
+ name: pry-byebug
100
100
  requirement: !ruby/object:Gem::Requirement
101
101
  requirements:
102
102
  - - "~>"
103
103
  - !ruby/object:Gem::Version
104
- version: '0.11'
104
+ version: '2.0'
105
105
  type: :development
106
106
  prerelease: false
107
107
  version_requirements: !ruby/object:Gem::Requirement
108
108
  requirements:
109
109
  - - "~>"
110
110
  - !ruby/object:Gem::Version
111
- version: '0.11'
111
+ version: '2.0'
112
112
  description: Gem to use Routific API
113
113
  email: asoesilo@live.com
114
114
  executables: []