diff options
| author | Xinhui | 2016-08-05 16:12:30 +0200 |
|---|---|---|
| committer | Xinhui | 2016-08-05 16:12:30 +0200 |
| commit | dd253db7dc07b18b93242a9587019489b0823ea3 (patch) | |
| tree | 3f99c99d8a684486026cf1d7cac1efc9a2750386 /lib | |
| parent | 0a762d0f7d8462f44cd4c13b26291261cd5d1424 (diff) | |
| download | chouette-core-dd253db7dc07b18b93242a9587019489b0823ea3.tar.bz2 | |
Refactoring organisations:sync task
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/tasks/organisations.rake | 6 | ||||
| -rw-r--r-- | lib/tasks/users.rake | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/lib/tasks/organisations.rake b/lib/tasks/organisations.rake index 24b02b630..94a9215b7 100644 --- a/lib/tasks/organisations.rake +++ b/lib/tasks/organisations.rake @@ -9,7 +9,11 @@ namespace :organisations do end resp = conn.get '/api/v1/organizations' - JSON.parse resp.body if resp.status == 200 + if resp.status == 200 + JSON.parse resp.body + else + raise "Error on api request status : #{resp.status} => #{resp.body}" + end end def sync_organisations data diff --git a/lib/tasks/users.rake b/lib/tasks/users.rake index ca2264381..15c76a240 100644 --- a/lib/tasks/users.rake +++ b/lib/tasks/users.rake @@ -9,7 +9,11 @@ namespace :users do end resp = conn.get '/api/v1/users' - JSON.parse resp.body if resp.status == 200 + if resp.status == 200 + JSON.parse resp.body + else + raise "Error on api request status : #{resp.status} => #{resp.body}" + end end def sync_users data |
