Commit 78185af3 authored by Mauricio Giacomini Girardello's avatar Mauricio Giacomini Girardello
Browse files

adding active_support lib

parent 1f1c8c55
...@@ -8,6 +8,7 @@ gem 'json' ...@@ -8,6 +8,7 @@ gem 'json'
gem 'resource_kit' gem 'resource_kit'
gem 'faraday' gem 'faraday'
gem 'net-http-persistent' gem 'net-http-persistent'
gem 'activesupport'
group :development, :spec do group :development, :spec do
gem 'minitest', '~> 5.8.3' gem 'minitest', '~> 5.8.3'
......
...@@ -2,7 +2,7 @@ require "forwardable" ...@@ -2,7 +2,7 @@ require "forwardable"
require "json" require "json"
require "resource_kit" require "resource_kit"
require "faraday" require "faraday"
require "active_support" require "active_support/all"
require_relative "dspace/version" require_relative "dspace/version"
require_relative "dspace/resources/community_resource" require_relative "dspace/resources/community_resource"
......
...@@ -7,13 +7,14 @@ module Dspace ...@@ -7,13 +7,14 @@ module Dspace
def initialize(options = {}) def initialize(options = {})
@access_token = options.with_indifferent_access[:access_token] @access_token = options.with_indifferent_access[:access_token]
@dspace_api = options.with_indifferent_access[:dspace_api] @dspace_api = options.with_indifferent_access[:dspace_api]
@logger = options.with_indifferent_access[:logger]
end end
def connection def connection
Faraday.new(connection_options) do |req| Faraday.new(connection_options) do |req|
req.request :multipart req.request :multipart
req.request :url_encoded req.request :url_encoded
req.use Faraday::Response::Logger, Logger.new('faraday.log') req.use(Faraday::Response::Logger, @logger) unless @logger.nil?
req.adapter :net_http_persistent req.adapter :net_http_persistent
end end
end end
......
...@@ -4,4 +4,4 @@ require 'faraday' ...@@ -4,4 +4,4 @@ require 'faraday'
faraday = Faraday.new('https://demo.dspace.org/', {ssl: {verify: false}, headers: {content_type: 'application/json', faraday = Faraday.new('https://demo.dspace.org/', {ssl: {verify: false}, headers: {content_type: 'application/json',
accept: 'application/json'}}) accept: 'application/json'}})
r = Dspace::Resources::CommunityResource.new(connection: faraday) r = Dspace::Resources::AuthenticationResource.new(connection: faraday)
\ No newline at end of file \ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment