to_spotlight 0.2 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 723cfc28349b5d450764bd91b70871ea4b2b326245a26b54ce84473263fb6ee3
4
- data.tar.gz: 3f8170875f2b4fc728ea963d505ead581cc9270d2e14f358b102df1780016994
3
+ metadata.gz: 5944a4acea93f3863a6f28ed2c50821e13ab4253f50ee66f375ddd875b960a30
4
+ data.tar.gz: 1ad10835c8271e17696a5d5ce3de25d96e7d563b731a162ffda1ccbbffc88839
5
5
  SHA512:
6
- metadata.gz: babde70f0e14fc18baacaa81069ca4ae66b4dda99eb5840f2ce7e9746f1a4f614548a78056641fb4be5d08371c76accef48ebdb4a47d4858cc56d728c97ce32a
7
- data.tar.gz: b7a3a177ed371b5393008b8cf9d1b2c4a5e5508fd6085c0e349ea3af9aece78931d7363b34246c1971fa6ee2563f73a6afa5f1e43b8a317656a199a141b8fd5d
6
+ metadata.gz: 2d2ebb3fabfc29cd787e25ba28a5af7b2c249de427b60a8b8a3321a99d93250fde1b350d276112c4eb962bbb36efa3df235898f2a10a48e2d1fbff4484c9f3dd
7
+ data.tar.gz: 599493c82a5051da4cb70db3ab32c66b89a541f6bdca1c17d94abeb9650754a3dfb663aaae82047a3596c2cd67e14e36d80929f51fec789a28e5d84a61db76b2
@@ -50,15 +50,22 @@ module ToSpotlight
50
50
  File.open(dir.join(filename), 'wb') do |file|
51
51
  file.write(csv_array.join("\n"))
52
52
  end
53
- byebug
54
- res = ::Net::HTTP.post URI("#{transfer.spotlight_url}/from_hyrax/receive"),
55
- { csv_url: "https://#{base_url}/uploads/csvs/#{filename}",
56
- transfer: transfer.attributes.except(:mappings), #only allow user+exhibit ??
57
- token: 'secret_token' }.to_json,
58
- 'Content-Type' => 'application/json'
53
+ res = post_response URI("#{transfer.spotlight_url}/from_hyrax/receive"),
54
+ csv_url: "https://#{base_url}/uploads/csvs/#{filename}",
55
+ transfer: transfer.attributes.slice(:user, :exhibit), #only allow user+exhibit
56
+ token: 'secret_token'
59
57
 
60
58
  end
61
59
 
60
+ def post_response uri, options={}
61
+ http = Net::HTTP.new(uri.host, uri.port)
62
+ http.use_ssl = true
63
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
64
+ request = Net::HTTP::Post.new(uri.request_uri, 'Content-Type' => 'application/json')
65
+ request.body = options.to_json
66
+ http.request(request)
67
+ end
68
+
62
69
  def base_url
63
70
  @base_url ||= ::Account.where(tenant: Apartment::Tenant.current).first.cname
64
71
  end
@@ -1,3 +1,3 @@
1
1
  module ToSpotlight
2
- VERSION = '0.2'
2
+ VERSION = '0.2.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: to_spotlight
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.2'
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - sephirothkod
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-02 00:00:00.000000000 Z
11
+ date: 2020-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails