geoserver-publish 0.2.1 → 0.3.0

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
- SHA1:
3
- metadata.gz: 9b85201c80f74582733ab3728fac7752cd047380
4
- data.tar.gz: 7a0a9e70743e05864769a7b80be97a31ec5aa403
2
+ SHA256:
3
+ metadata.gz: '038968f3cbde7d9a19944be64b05d0ff2d51b73d342b2828d80758389c3ee544'
4
+ data.tar.gz: 2876f56b1401b5f0108fce1a429b99e94c860c029ae8da417bcb429ba7d179ad
5
5
  SHA512:
6
- metadata.gz: b490dd39003f22b78df79bc06aadecd97a3fa8e38f2fa6288a86b6bc65702b1a29c92158938ebb2671110352eea5250e2ff08d4bf5d7cfbd6e31c0757c60e6f6
7
- data.tar.gz: 884807b0eee8e7c74bb2b6184de024d176de393b87a4456bf9af26eb5a430e324f2ef24ed077c70a52b6e254549c18e153db72280d0aa051d498d018c1f416d8
6
+ metadata.gz: 8506a643df04755609e2d7b02063ccde7ee22db949dd5a868267a4d029273c04afd82e633a34db2db1578bfe916ba72e0cfaa67c1eed0b08829668a7a7d7c3b8
7
+ data.tar.gz: a73bc4fef84d232ea2463d32b0e747706e8048487ef5558254359e547f7feba0f95dbc0cd1761dc6e4318d347e5542380f4e6a6bc794c542215c752ffc4af3a6
@@ -1,5 +1,5 @@
1
1
  sudo: false
2
2
  language: ruby
3
3
  rvm:
4
- - 2.4.2
5
- before_install: gem install bundler -v 1.16.1
4
+ - 2.6.5
5
+ before_install: gem install bundler
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Geoserver::Publish
2
2
 
3
- [![Build Status](https://img.shields.io/travis/pulibrary/geoserver-publish/master.svg)](https://travis-ci.org/pulibrary/geoserver-publish)
4
- [![Coverage Status](https://img.shields.io/coveralls/pulibrary/geoserver-publish/master.svg)](https://coveralls.io/github/pulibrary/geoserver-publish?branch=master)
3
+ [![Build Status](https://img.shields.io/travis/samvera-labs/geoserver-publish/master.svg)](https://travis-ci.org/samvera-labs/geoserver-publish)
4
+ [![Coverage Status](https://img.shields.io/coveralls/samvera-labs/geoserver-publish/master.svg)](https://coveralls.io/github/samvera-labs/geoserver-publish?branch=master)
5
5
 
6
6
  Simple client for publishing Shapefiles and GeoTIFFs to Geoserver.
7
7
 
@@ -78,4 +78,4 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
78
78
 
79
79
  ## Contributing
80
80
 
81
- Bug reports and pull requests are welcome on GitHub at https://github.com/pulibrary/geoserver-publish.
81
+ Bug reports and pull requests are welcome on GitHub at https://github.com/samvera-labs/geoserver-publish.
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
25
25
 
26
26
  spec.add_dependency "faraday"
27
27
 
28
- spec.add_development_dependency "bundler", "~> 1.16"
28
+ spec.add_development_dependency "bundler", "> 1.16.0", "< 3"
29
29
  spec.add_development_dependency "rake", "~> 10.0"
30
30
  spec.add_development_dependency "rspec", "~> 3.0"
31
31
  end
@@ -35,6 +35,17 @@ module Geoserver
35
35
  raise Geoserver::Publish::Error, response.reason_phrase
36
36
  end
37
37
 
38
+ def put(path:, payload:, content_type:)
39
+ response = faraday_connection.put do |req|
40
+ req.url path
41
+ req.headers['Content-Type'] = content_type
42
+ req.body = payload
43
+ end
44
+ return true if response.status == 201 || response.status == 200
45
+
46
+ raise Geoserver::Publish::Error, response.reason_phrase
47
+ end
48
+
38
49
  private
39
50
 
40
51
  def faraday_connection
@@ -25,6 +25,12 @@ module Geoserver
25
25
  connection.post(path: path, payload: payload)
26
26
  end
27
27
 
28
+ def upload(workspace_name:, data_store_name:, file:)
29
+ content_type = 'application/zip'
30
+ path = upload_url(workspace: workspace_name, data_store: data_store_name)
31
+ connection.put(path: path, payload: file, content_type: content_type)
32
+ end
33
+
28
34
  private
29
35
 
30
36
  def data_store_url(workspace_name:, data_store_name:)
@@ -32,6 +38,10 @@ module Geoserver
32
38
  "workspaces/#{workspace_name}/datastores#{last_path_component}"
33
39
  end
34
40
 
41
+ def upload_url(workspace:, data_store:)
42
+ "workspaces/#{workspace}/datastores/#{data_store}/file.shp"
43
+ end
44
+
35
45
  # rubocop:disable Metrics/MethodLength
36
46
  def payload_new(data_store_name:, url:)
37
47
  {
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  module Geoserver
3
3
  module Publish
4
- VERSION = "0.2.1"
4
+ VERSION = "0.3.0"
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geoserver-publish
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eliot Jordan
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-11-26 00:00:00.000000000 Z
11
+ date: 2020-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -28,16 +28,22 @@ dependencies:
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">"
32
+ - !ruby/object:Gem::Version
33
+ version: 1.16.0
34
+ - - "<"
32
35
  - !ruby/object:Gem::Version
33
- version: '1.16'
36
+ version: '3'
34
37
  type: :development
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
37
40
  requirements:
38
- - - "~>"
41
+ - - ">"
42
+ - !ruby/object:Gem::Version
43
+ version: 1.16.0
44
+ - - "<"
39
45
  - !ruby/object:Gem::Version
40
- version: '1.16'
46
+ version: '3'
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: rake
43
49
  requirement: !ruby/object:Gem::Requirement
@@ -114,8 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
114
120
  - !ruby/object:Gem::Version
115
121
  version: '0'
116
122
  requirements: []
117
- rubyforge_project:
118
- rubygems_version: 2.4.5
123
+ rubygems_version: 3.0.3
119
124
  signing_key:
120
125
  specification_version: 4
121
126
  summary: Simple client for publishing Shapefiles and GeoTIFFs to Geoserver