Skip to content

Commit

Permalink
use excon for requests to elasticsearch. #178
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Jan 4, 2019
1 parent 5f2e78a commit 0d1dfdc
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 11 deletions.
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ gem 'nokogiri', '~> 1.8.1'
gem 'diffy', '~> 3.2', '>= 3.2.1'
gem 'commonmarker', '~> 0.17.9'
gem 'iso8601', '~> 0.9.0'
gem 'patron', '~> 0.13.1', require: false
gem 'maremma', '>= 4.1'
gem 'bolognese', '~> 1.0'
gem 'dalli', '~> 2.7', '>= 2.7.6'
Expand Down
12 changes: 5 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ GEM
api-pagination (4.8.2)
arel (9.0.0)
aws-eventstream (1.0.1)
aws-partitions (1.127.0)
aws-partitions (1.128.0)
aws-sdk-core (3.44.1)
aws-eventstream (~> 1.0)
aws-partitions (~> 1.0)
Expand Down Expand Up @@ -166,7 +166,7 @@ GEM
database_cleaner (1.7.0)
debug_inspector (0.0.3)
diff-lcs (1.3)
diffy (3.2.1)
diffy (3.3.0)
docile (1.1.5)
docopt (0.6.1)
domain_name (0.5.20180417)
Expand Down Expand Up @@ -230,12 +230,12 @@ GEM
tilt
hamster (3.0.0)
concurrent-ruby (~> 1.0)
hashdiff (0.3.7)
hashdiff (0.3.8)
hashie (3.6.0)
htmlentities (4.3.4)
http-cookie (1.0.3)
domain_name (~> 0.5)
i18n (1.3.0)
i18n (1.4.0)
concurrent-ruby (~> 1.0)
i18n_data (0.8.0)
iso8601 (0.9.1)
Expand Down Expand Up @@ -318,7 +318,6 @@ GEM
oj (2.18.5)
oj_mimic_json (1.0.1)
pandoc-ruby (2.0.2)
patron (0.13.1)
postrank-uri (1.0.23)
addressable (>= 2.3.0, < 2.6)
nokogiri (>= 1.6.1, < 1.9)
Expand Down Expand Up @@ -367,7 +366,7 @@ GEM
rb-fsevent (0.10.3)
rb-inotify (0.10.0)
ffi (~> 1.0)
rdf (3.0.7)
rdf (3.0.9)
hamster (~> 3.0)
link_header (~> 0.0, >= 0.0.8)
rdf-aggregate-repo (2.2.1)
Expand Down Expand Up @@ -535,7 +534,6 @@ DEPENDENCIES
nokogiri (~> 1.8.1)
oj (>= 2.8.3)
oj_mimic_json (~> 1.0, >= 1.0.1)
patron (~> 0.13.1)
premailer (~> 1.11, >= 1.11.1)
pwqgen.rb (~> 0.1.0)
rack-cors (~> 1.0, >= 1.0.2)
Expand Down
1 change: 1 addition & 0 deletions app/serializers/client_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ class ClientSerializer
set_key_transform :camel_lower
set_type :clients
set_id :uid
cache_options enabled: true, cache_length: 24.hours

attributes :name, :symbol, :year, :contact_name, :contact_email, :description, :domains, :url, :created, :updated

Expand Down
1 change: 1 addition & 0 deletions app/serializers/doi_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ class DoiSerializer
set_key_transform :camel_lower
set_type :dois
set_id :uid
# don't cache dois, as works are cached using the doi model

attributes :doi, :prefix, :suffix, :identifiers, :creators, :titles, :publisher, :container, :publication_year, :subjects, :contributors, :dates, :language, :types, :related_identifiers, :sizes, :formats, :version, :rights_list, :descriptions, :geo_locations, :funding_references, :xml, :url, :content_url, :metadata_version, :schema_version, :source, :is_active, :state, :reason, :landing_page, :created, :registered, :updated
attributes :prefix, :suffix, if: Proc.new { |object, params| params && params[:detail] }
Expand Down
1 change: 1 addition & 0 deletions app/serializers/provider_prefix_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ class ProviderPrefixSerializer
set_type "provider-prefixes"
set_id :uid
attributes :created, :updated
cache_options enabled: true, cache_length: 24.hours

belongs_to :provider, record_type: :providers
belongs_to :prefix, record_type: :prefixes
Expand Down
1 change: 1 addition & 0 deletions app/serializers/provider_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ class ProviderSerializer
set_key_transform :camel_lower
set_type :providers
set_id :uid
cache_options enabled: true, cache_length: 24.hours

attributes :name, :symbol, :website, :contact_name, :contact_email, :phone, :description, :region, :country, :logo_url, :organization_type, :focus_area, :is_active, :has_password, :joined, :created, :updated

Expand Down
1 change: 1 addition & 0 deletions app/serializers/work_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ class WorkSerializer
set_key_transform :dash
set_type :works
set_id :identifier
cache_options enabled: true, cache_length: 24.hours

attributes :doi, :identifier, :url, :author, :title, :container_title, :description, :resource_type_subtype, :data_center_id, :member_id, :resource_type_id, :version, :license, :schema_version, :results, :related_identifiers, :published, :registered, :checked, :updated, :media, :xml

Expand Down
2 changes: 1 addition & 1 deletion config/initializers/_version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Lupo
class Application
VERSION = "2.3"
VERSION = "2.3.1"
end
end
4 changes: 2 additions & 2 deletions config/initializers/elasticsearch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
}
}
Elasticsearch::Model.client = Elasticsearch::Client.new(host: ENV['ES_HOST'], user: "elastic", password: ENV['ELASTIC_PASSWORD']) do |f|
f.adapter Faraday.default_adapter
f.adapter :excon
end
else
Elasticsearch::Model.client = Elasticsearch::Client.new(host: ENV['ES_HOST'], port: '80', scheme: 'http') do |f|
Expand All @@ -18,6 +18,6 @@
service: 'es',
region: ENV['AWS_REGION']

f.adapter Faraday.default_adapter
f.adapter :excon
end
end

0 comments on commit 0d1dfdc

Please sign in to comment.