diff options
| author | teddywing | 2017-08-01 17:54:02 +0200 | 
|---|---|---|
| committer | GitHub | 2017-08-01 17:54:02 +0200 | 
| commit | 8774b48a41779248d58c78eb305ce1c579c82708 (patch) | |
| tree | 4fb5b465225565b258ecb5e62c0e965637cf052c /app/models/organisation.rb | |
| parent | 84d73a0b872b078ae5b73e2f8f2db2bb304622c2 (diff) | |
| parent | 1f09ead58c9c603e9d767781ceb82859b2393f49 (diff) | |
| download | chouette-core-8774b48a41779248d58c78eb305ce1c579c82708.tar.bz2 | |
Merge pull request #48 from af83/1726-WorkbenchImport-for-multi-Netex-import
1726 workbench import for multi netex import
Diffstat (limited to 'app/models/organisation.rb')
| -rw-r--r-- | app/models/organisation.rb | 18 | 
1 files changed, 5 insertions, 13 deletions
diff --git a/app/models/organisation.rb b/app/models/organisation.rb index d0742bda6..f697122aa 100644 --- a/app/models/organisation.rb +++ b/app/models/organisation.rb @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*-  class Organisation < ActiveRecord::Base    include DataFormatEnumerations @@ -26,19 +25,12 @@ class Organisation < ActiveRecord::Base    def self.portail_api_request      conf = Rails.application.config.try(:stif_portail_api) -    raise 'Rails.application.config.stif_portail_api settings is not defined' unless conf +    raise 'Rails.application.config.stif_portail_api configuration is not defined' unless conf -    conn = Faraday.new(:url => conf[:url]) do |c| -      c.headers['Authorization'] = "Token token=\"#{conf[:key]}\"" -      c.adapter  Faraday.default_adapter -    end - -    resp = conn.get '/api/v1/organizations' -    if resp.status == 200 -      JSON.parse resp.body -    else -      raise "Error on api request status : #{resp.status} => #{resp.body}" -    end +    HTTPService.get_json_resource( +      host: conf[:url], +      path: '/api/v1/organizations', +      token: conf[:key])    end    def self.sync_update code, name, scope  | 
