plate_api 1.2.0 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/Gemfile.lock +1 -3
- data/lib/plate_api/post_multipart_request.rb +7 -6
- data/lib/plate_api/version.rb +1 -1
- data/plate_api.gemspec +13 -15
- metadata +1 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 251666f577ba0ea7439b6dfa90acfe15e9ac7724a827a8133f4eaf092124d109
|
4
|
+
data.tar.gz: a4e9c0676b64b4e324826864045cd09ba1b3e5ef68d4f6ed1b58821b136f54dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a691fd2429453636ebb4f0c4fbe3aa1498a2550374f5eb220ba25135dc3580d95a4e34f074e4c948b6e5a326505c0a82e17fe928b2a0ac05d0cbb1556c307879
|
7
|
+
data.tar.gz: '09a484411bf28eb37862f11b514ae3e43385b904bad989fa448cb5174ef1b3ea2793c4289186d9b4b0de5eceb37a249fbcebc15d5ac885499eda6e309040b65f'
|
data/.travis.yml
CHANGED
@@ -6,7 +6,7 @@ sudo: false
|
|
6
6
|
language: ruby
|
7
7
|
rvm:
|
8
8
|
- 2.5.1
|
9
|
-
before_install: gem install bundler -v 1.
|
9
|
+
before_install: gem install bundler -v 2.1.4
|
10
10
|
before_script:
|
11
11
|
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
12
12
|
- chmod +x ./cc-test-reporter
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
plate_api (1.2.
|
4
|
+
plate_api (1.2.2)
|
5
5
|
faraday (~> 1.0.1)
|
6
|
-
mimemagic (~> 0.3.3)
|
7
6
|
|
8
7
|
GEM
|
9
8
|
remote: https://rubygems.org/
|
@@ -30,7 +29,6 @@ GEM
|
|
30
29
|
hashdiff (1.0.1)
|
31
30
|
i18n (1.8.2)
|
32
31
|
concurrent-ruby (~> 1.0)
|
33
|
-
mimemagic (0.3.5)
|
34
32
|
minitest (5.14.1)
|
35
33
|
multipart-post (2.1.1)
|
36
34
|
public_suffix (4.0.5)
|
@@ -1,11 +1,8 @@
|
|
1
|
-
require 'mimemagic'
|
2
|
-
|
3
1
|
module PlateApi
|
4
2
|
class PostMultipartRequest < Request
|
5
3
|
HttpAdapter = :net_http
|
6
|
-
MimeMagic.add('image/jpeg', extensions: "jfif")
|
7
4
|
|
8
|
-
def initialize(public_key, secret, path, parameters={}, custom_server=nil)
|
5
|
+
def initialize(public_key, secret, path, parameters = {}, custom_server = nil)
|
9
6
|
super(public_key, secret, "POST", path, custom_server)
|
10
7
|
|
11
8
|
@post_parameters = map_parameters(parameters)
|
@@ -13,19 +10,23 @@ module PlateApi
|
|
13
10
|
|
14
11
|
def extra_builder_options(builder)
|
15
12
|
builder.request :multipart
|
16
|
-
|
13
|
+
builder.request :url_encoded
|
17
14
|
end
|
18
15
|
|
19
16
|
def extra_request_options(request)
|
20
17
|
request.body = @post_parameters
|
21
18
|
end
|
22
19
|
|
20
|
+
def mime_type(full_path)
|
21
|
+
IO.popen(["file", "--brief", "--mime-type", full_path], in: :close, err: :close) { |io| io.read.chomp }
|
22
|
+
end
|
23
|
+
|
23
24
|
def map_parameters(parameters)
|
24
25
|
parameters.keys.each do |key|
|
25
26
|
val = parameters[key]
|
26
27
|
if val.is_a? File
|
27
28
|
full_path = File.expand_path(val)
|
28
|
-
mime_type =
|
29
|
+
mime_type = self.mime_type(full_path)
|
29
30
|
parameters[key] = Faraday::UploadIO.new(full_path, mime_type)
|
30
31
|
end
|
31
32
|
end
|
data/lib/plate_api/version.rb
CHANGED
data/plate_api.gemspec
CHANGED
@@ -1,20 +1,19 @@
|
|
1
|
-
|
2
1
|
lib = File.expand_path("../lib", __FILE__)
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
3
|
require "plate_api/version"
|
5
4
|
|
6
5
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name
|
8
|
-
spec.version
|
9
|
-
spec.date
|
10
|
-
spec.summary
|
6
|
+
spec.name = "plate_api"
|
7
|
+
spec.version = PlateApi::VERSION
|
8
|
+
spec.date = "2019-01-05"
|
9
|
+
spec.summary = "Connector for the Plate API"
|
11
10
|
spec.description = "This gem can be used to connect to the Plate API. It takes care
|
12
11
|
of the authentication procedure. It also provides a basic wrapper around the Plate API,
|
13
12
|
so objects in Plate can be manipulated as local objects."
|
14
|
-
spec.authors
|
15
|
-
spec.email
|
16
|
-
spec.files
|
17
|
-
spec.license
|
13
|
+
spec.authors = ["David Kortleven", "Harmen Fuite"]
|
14
|
+
spec.email = ["david@getplate.com", "harmen@getplate.com"]
|
15
|
+
spec.files = ["lib/plate_api.rb"]
|
16
|
+
spec.license = "MIT"
|
18
17
|
|
19
18
|
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
20
19
|
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
@@ -22,19 +21,19 @@ Gem::Specification.new do |spec|
|
|
22
21
|
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
23
22
|
else
|
24
23
|
raise "RubyGems 2.0 or newer is required to protect against " \
|
25
|
-
|
24
|
+
"public gem pushes."
|
26
25
|
end
|
27
26
|
|
28
|
-
spec.files
|
27
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
29
28
|
f.match(%r{^(test|spec|features)/})
|
30
29
|
end
|
31
|
-
spec.bindir
|
32
|
-
spec.executables
|
30
|
+
spec.bindir = "exe"
|
31
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
33
32
|
spec.require_paths = ["lib"]
|
34
33
|
|
35
34
|
spec.add_dependency "faraday", "~> 1.0.1"
|
36
35
|
# spec.add_dependency "faraday_middleware", "~> 0.13.1"
|
37
|
-
spec.add_dependency "mimemagic", "~> 0.3.
|
36
|
+
# spec.add_dependency "mimemagic", "~> 0.3.10"
|
38
37
|
|
39
38
|
spec.add_development_dependency "bundler", "~> 2.1.4"
|
40
39
|
spec.add_development_dependency "rake", "~> 13.0"
|
@@ -44,5 +43,4 @@ Gem::Specification.new do |spec|
|
|
44
43
|
spec.add_development_dependency "simplecov"
|
45
44
|
spec.add_development_dependency "simplecov-console"
|
46
45
|
spec.add_development_dependency "byebug"
|
47
|
-
|
48
46
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: plate_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Kortleven
|
@@ -25,20 +25,6 @@ dependencies:
|
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: 1.0.1
|
28
|
-
- !ruby/object:Gem::Dependency
|
29
|
-
name: mimemagic
|
30
|
-
requirement: !ruby/object:Gem::Requirement
|
31
|
-
requirements:
|
32
|
-
- - "~>"
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: 0.3.3
|
35
|
-
type: :runtime
|
36
|
-
prerelease: false
|
37
|
-
version_requirements: !ruby/object:Gem::Requirement
|
38
|
-
requirements:
|
39
|
-
- - "~>"
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
version: 0.3.3
|
42
28
|
- !ruby/object:Gem::Dependency
|
43
29
|
name: bundler
|
44
30
|
requirement: !ruby/object:Gem::Requirement
|