plate_api 1.1.8 → 1.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '09bf65656de8336735c86096cbce1c5c951523f6b7cfa0d55ef6ed43dbeb1d78'
4
- data.tar.gz: 7145e01a452dbfdb604d83f5d660587fc6deaef70fa98f0b61fcc1c21dfc9137
3
+ metadata.gz: 503eedbe972dc1af57701afbafd35a6ad76e106d86b94ad32093a40d5c63d1da
4
+ data.tar.gz: 4df9c933309cfe2217882548fa88f525e45852a7356229b3488b7ea8f6759dee
5
5
  SHA512:
6
- metadata.gz: cdad0d6cfd4dee24ff415c3a781eb70d43c3141c340a2526f3cb22cb3748cd7bdf2a9de0151930454b106ea8ce9079f3b8e915e92730e07c00035f0b7d042f40
7
- data.tar.gz: 8819d44883e6ca4be2c1c1a2a657ad76a326c2ddd38d79dced69ab9fd284eff210bd283ac4fa72a07460e93afcf14b69e1434a9514d2019802271893c9c46586
6
+ metadata.gz: 775b16afb1ea5c15e5203a241bb74509e04a1a573539f498c3a612c91b90b094dfbe8304d2d2158b5fd10d18d0949acbcf1f1cddcffe82edea5cc75aba73bfc8
7
+ data.tar.gz: 464e4c82997c7d0177f19bc39b351ff77fbb2584aada96aab67e6e5ec4a39ee482130c150f3322f3054309f343c9b80e2e7f169388aede15e6084dada4b6d4fc
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.16.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/Dockerfile ADDED
@@ -0,0 +1,6 @@
1
+ FROM ruby:2.7
2
+
3
+ RUN mkdir /plate_api
4
+ WORKDIR /plate_api
5
+ COPY . /plate_api
6
+ RUN bin/setup
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- plate_api (1.1.8)
4
+ plate_api (1.2.4)
5
5
  faraday (~> 1.0.1)
6
- mimemagic (~> 0.3.3)
6
+ mime-types (~> 3.3.1)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
@@ -30,7 +30,9 @@ GEM
30
30
  hashdiff (1.0.1)
31
31
  i18n (1.8.2)
32
32
  concurrent-ruby (~> 1.0)
33
- mimemagic (0.3.5)
33
+ mime-types (3.3.1)
34
+ mime-types-data (~> 3.2015)
35
+ mime-types-data (3.2021.0225)
34
36
  minitest (5.14.1)
35
37
  multipart-post (2.1.1)
36
38
  public_suffix (4.0.5)
data/README.md CHANGED
@@ -145,6 +145,12 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
145
145
 
146
146
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
147
147
 
148
+ ## Run Specs with Docker
149
+ ```bash
150
+ docker build -t plate_api_gem .
151
+ docker run --rm -it plate_api_gem rspec
152
+ ```
153
+
148
154
  ## License
149
155
 
150
156
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -5,42 +5,44 @@ module PlateApi
5
5
  attr_reader :handling_class
6
6
 
7
7
  def initialize(handling_class, api_connector)
8
- raise ArgumentError.new("`handling_class` given for #new is not valid") unless handling_class
9
- raise ArgumentError.new("`api_connector` given for #new is not valid") unless api_connector
8
+ raise ArgumentError, "`handling_class` given for #new is not valid" unless handling_class
9
+ raise ArgumentError, "`api_connector` given for #new is not valid" unless api_connector
10
+
10
11
  @handling_class = handling_class
11
12
  @api_connector = api_connector
12
13
  end
13
14
 
14
15
  def find(id)
15
- raise ArgumentError.new("`id` given for #find is not valid") unless id
16
+ raise ArgumentError, "`id` given for #find is not valid" unless id
17
+
16
18
  result = @api_connector.get(resource_path(id))
17
19
  if result["data"]
18
- return new_object(result["data"])
20
+ new_object(result["data"])
19
21
  else
20
- puts "PlateApi: No success: #{result}"
21
- return nil
22
+ raise ResponseError, result
22
23
  end
23
24
  end
24
25
 
25
26
  def update(id, attributes)
26
- raise ArgumentError.new("`id` given for #update is not valid") unless id
27
- raise ArgumentError.new("`attributes` given for #update is not valid") unless attributes.is_a? Hash
28
- result = @api_connector.put(resource_path(id), {"data" => attributes})
27
+ raise ArgumentError, "`id` given for #update is not valid" unless id
28
+ raise ArgumentError, "`attributes` given for #update is not valid" unless attributes.is_a?(Hash)
29
+
30
+ result = @api_connector.put(resource_path(id), { "data" => attributes })
29
31
 
30
32
  if result["data"]
31
- return new_object(result["data"])
33
+ new_object(result["data"])
32
34
  else
33
- puts "PlateApi: No success: #{result}"
34
- return nil
35
+ raise ResponseError, result
35
36
  end
36
37
  end
37
38
 
38
- def create(parent, attributes, create_method=:post)
39
- raise ArgumentError.new("`parent` given for #create is not valid") unless parent
40
- raise ArgumentError.new("`attributes` given for #create is not valid") unless attributes.is_a? Hash
39
+ def create(parent, attributes, create_method = :post)
40
+ raise ArgumentError, "`parent` given for #create is not valid" unless parent
41
+ raise ArgumentError, "`attributes` given for #create is not valid" unless attributes.is_a?(Hash)
42
+
41
43
  parameters = case create_method
42
44
  when :post
43
- {"data" => attributes}
45
+ { "data" => attributes }
44
46
  when :post_multipart
45
47
  attributes
46
48
  end
@@ -48,49 +50,70 @@ module PlateApi
48
50
  result = @api_connector.send(create_method, collection_path(parent.class, parent.id), parameters)
49
51
 
50
52
  if result["data"]
51
- return new_object(result["data"])
53
+ new_object(result["data"])
52
54
  else
53
- puts "PlateApi: No success: #{result}"
54
- return nil
55
+ raise ResponseError, result
55
56
  end
56
57
  end
57
58
 
58
59
  def delete(id)
59
- raise ArgumentError.new("`id` given for #find is not valid") unless id
60
+ raise ArgumentError, "`id` given for #find is not valid" unless id
61
+
60
62
  result = @api_connector.delete(resource_path(id))
61
63
  if result["data"]
62
- return new_object(result["data"])
64
+ new_object(result["data"])
63
65
  else
64
- puts "PlateApi: No success: #{result}"
65
- return nil
66
+ raise ResponseError, result
66
67
  end
67
68
  end
68
69
 
69
- def index(parent_class, parent_id, extra_params={})
70
- raise ArgumentError.new("`parent_id` given for #index is not valid") unless parent_id
71
- raise ArgumentError.new("`parent_class` given for #index is not valid") unless parent_class
70
+ def index(parent_class, parent_id, extra_params = {}, return_raw = false)
71
+ raise ArgumentError, "`parent_id` given for #index is not valid" unless parent_id
72
+ raise ArgumentError, "`parent_class` given for #index is not valid" unless parent_class
72
73
 
73
74
  result = @api_connector.get(collection_path(parent_class, parent_id), extra_params)
74
- if result["data"]
75
- return result["data"].map{|x| new_object(x)}
76
- else
77
- puts "PlateApi: No success: #{result}"
78
- return nil
75
+ raise ResponseError, result unless result["data"]
76
+ return result if return_raw
77
+
78
+ result["data"].map { |x| new_object(x) }
79
+ end
80
+
81
+ def index_block(parent_class, parent_id, extra_params = {}, &block)
82
+ extra_params[:page] = extra_params.delete("page") if extra_params["page"]
83
+ extra_params[:page] = 1 unless extra_params[:page]
84
+
85
+ pagination = index_block_iteration(parent_class, parent_id, extra_params, &block)
86
+ return unless pagination
87
+
88
+ while pagination["page"] < pagination["total_pages"]
89
+ extra_params.merge!(page: (pagination["page"] + 1))
90
+ pagination = index_block_iteration(parent_class, parent_id, extra_params, &block)
91
+ break unless pagination
79
92
  end
80
93
  end
81
94
 
82
95
  def index_total_count(parent)
83
96
  result = @api_connector.get(collection_path(parent.class, parent.id), per_page: 1)
84
97
  if result["meta"]
85
- return result["meta"]["pagination"]["total_records"]
98
+ result["meta"]["pagination"]["total_records"]
86
99
  else
87
- puts "PlateApi: No success: #{result}"
88
- return nil
100
+ raise ResponseError, result
89
101
  end
90
102
  end
91
103
 
92
104
  private
93
105
 
106
+ def index_block_iteration(parent_class, parent_id, params)
107
+ result = index(parent_class, parent_id, params, true)
108
+ objects = result["data"].map { |x| new_object(x) }
109
+ meta = result["meta"]
110
+ yield(objects, meta)
111
+
112
+ # Returns pagination metadata so it can be used to
113
+ # iterate through the pages.
114
+ meta["pagination"] if meta
115
+ end
116
+
94
117
  # Construct a new object of @handling_class, given a succesful api_response
95
118
  def new_object(api_response)
96
119
  @handling_class.new(
@@ -105,15 +128,15 @@ module PlateApi
105
128
  "#{@handling_class.api_name}/#{id}"
106
129
  end
107
130
 
108
- def collection_path(parent_class=nil, parent_id=nil)
109
- if (parent_class != nil) ^ (parent_id != nil)
110
- raise ArgumentError.new("An invalid combination `parent_class` and `parent_id` is given. Provide both or none.")
131
+ def collection_path(parent_class = nil, parent_id = nil)
132
+ if (!parent_class.nil?) ^ (!parent_id.nil?)
133
+ raise ArgumentError, "An invalid combination `parent_class` and `parent_id` is given. Provide both or none."
111
134
  end
112
135
 
113
136
  if parent_class
114
137
  "#{parent_class.api_name}/#{parent_id}/#{@handling_class.api_name}"
115
138
  else
116
- "#{@handling_class.api_name}"
139
+ @handling_class.api_name.to_s
117
140
  end
118
141
  end
119
142
  end
@@ -6,7 +6,7 @@ module PlateApi::PlateObject
6
6
  HasOneRelations = {}
7
7
  HasManyRelations = {}
8
8
 
9
- def initialize(id, attributes, relations, object_handler=nil)
9
+ def initialize(id, attributes, relations, object_handler = nil)
10
10
  @id = id
11
11
  @object_handler = object_handler
12
12
  initialize_state(attributes, relations)
@@ -17,24 +17,27 @@ module PlateApi::PlateObject
17
17
  end
18
18
 
19
19
  def reload
20
- raise ArgumentError.new("No object_handler is set.") unless @object_handler
20
+ raise ArgumentError, "No object_handler is set." unless @object_handler
21
+
21
22
  reinitialize(@object_handler.find(@id))
22
- return self
23
+ self
23
24
  end
24
25
 
25
26
  def update(attributes)
26
- raise ArgumentError.new("Input `attributes` is not a Hash") unless attributes.is_a? Hash
27
- raise ArgumentError.new("No object_handler is attached to this object") unless @object_handler
27
+ raise ArgumentError, "Input `attributes` is not a Hash" unless attributes.is_a?(Hash)
28
+ raise ArgumentError, "No object_handler is attached to this object" unless @object_handler
29
+
28
30
  if new_object = @object_handler.update(@id, attributes)
29
31
  reinitialize(new_object)
30
32
  else
31
- raise ArgumentError.new("The update was unsuccesful.")
33
+ raise ArgumentError, "The update was unsuccesful."
32
34
  end
33
- return self
35
+ self
34
36
  end
35
37
 
36
38
  def delete
37
- raise ArgumentError.new("No object_handler is attached to this object") unless @object_handler
39
+ raise ArgumentError, "No object_handler is attached to this object" unless @object_handler
40
+
38
41
  @object_handler.delete(@id)
39
42
  end
40
43
 
@@ -46,18 +49,25 @@ module PlateApi::PlateObject
46
49
  to_s
47
50
  end
48
51
 
49
- def method_missing(m, *args, &block)
50
- if attributes[m.to_s]
51
- return attributes[m.to_s]
52
- elsif attributes["content"] && attributes["content"][m.to_s]
53
- return attributes["content"][m.to_s]["value"]
52
+ def method_missing(method_name, *args, &block)
53
+ if attributes[method_name.to_s]
54
+ attributes[method_name.to_s]
55
+ elsif attributes["content"] && attributes["content"][method_name.to_s]
56
+ attributes["content"][method_name.to_s]["value"]
54
57
  else
55
58
  super
56
59
  end
57
60
  end
58
61
 
62
+ def respond_to_missing?(method_name, include_private = false)
63
+ return true if attributes[method_name.to_s]
64
+ return true if attributes["content"] && attributes["content"][method_name.to_s]
65
+
66
+ super
67
+ end
68
+
59
69
  def ==(other)
60
- return other.id == @id && other.class == self.class
70
+ other.id == @id && other.class == self.class
61
71
  end
62
72
 
63
73
  private
@@ -72,56 +82,68 @@ module PlateApi::PlateObject
72
82
  @relations = relations
73
83
  end
74
84
 
75
- def self.has_one(name, klass)
76
- HasOneRelations[self.name] ||= {}
77
- self.attr_accessor "#{name}_id"
78
- HasOneRelations[self.name][name.to_s] = klass
79
- define_has_one_method(name, klass)
80
- end
85
+ def set_relation_ids(relations_attributes)
86
+ HasOneRelations[self.class.name] ||= {}
81
87
 
82
- def self.define_has_one_method(name, klass)
83
- define_method(name.to_s) do
84
- id = self.send("#{name}_id")
85
- return nil unless id
86
- @object_handler.api_connector.handler(Object.const_get(klass)).find(id)
88
+ return unless relations_attributes
89
+
90
+ self.class::HasOneRelations[self.class.name].keys.each do |relation_name|
91
+ val = relations_attributes["#{relation_name}_id"]
92
+ if val
93
+ send("#{relation_name}_id=", val)
94
+ end
87
95
  end
88
96
  end
89
97
 
90
- def self.has_many(plural_name, singular_name, klass, define_create_method=false)
91
- HasManyRelations[self.name] ||= {}
92
- HasManyRelations[self.name][plural_name.to_s] = klass
93
- define_has_many_methods(plural_name, klass)
94
- define_create_method(singular_name, klass) if define_create_method
95
- end
98
+ class << self
99
+ private
96
100
 
97
- def self.define_has_many_methods(plural_name, klass)
98
- define_method(plural_name.to_s) do |params={}|
99
- @object_handler.api_connector.handler(
100
- Object.const_get(klass)
101
- ).index(self.class, @id, params)
101
+ def has_one(name, klass)
102
+ HasOneRelations[self.name] ||= {}
103
+ attr_accessor("#{name}_id")
104
+ HasOneRelations[self.name][name.to_s] = klass
105
+ define_has_one_method(name, klass)
102
106
  end
103
107
 
104
- define_method("#{plural_name}_total_count") do
105
- @object_handler.api_connector.handler(
106
- Object.const_get(klass)
107
- ).index_total_count(self)
108
+ def define_has_one_method(name, klass)
109
+ define_method(name.to_s) do
110
+ id = send("#{name}_id")
111
+ return nil unless id
112
+
113
+ @object_handler.api_connector.handler(Object.const_get(klass)).find(id)
114
+ end
108
115
  end
109
- end
110
116
 
111
- def self.define_create_method(singular_name, klass)
112
- define_method("create_#{singular_name}") do |create_attributes|
113
- @object_handler.api_connector.handler(Object.const_get(klass)).create(self, create_attributes)
117
+ def has_many(plural_name, singular_name, klass, define_create_method = false)
118
+ HasManyRelations[name] ||= {}
119
+ HasManyRelations[name][plural_name.to_s] = klass
120
+ define_has_many_methods(plural_name, klass)
121
+ define_create_method(singular_name, klass) if define_create_method
114
122
  end
115
- end
116
123
 
117
- def set_relation_ids(relations_attributes)
118
- HasOneRelations[self.class.name] ||= {}
124
+ def define_has_many_methods(plural_name, klass)
125
+ define_method(plural_name.to_s) do |params = {}|
126
+ @object_handler.api_connector.handler(
127
+ Object.const_get(klass)
128
+ ).index(self.class, @id, params)
129
+ end
119
130
 
120
- return unless relations_attributes
121
- self.class::HasOneRelations[self.class.name].keys.each do |relation_name|
122
- val = relations_attributes["#{relation_name}_id"]
123
- if val
124
- send("#{relation_name}_id=", val)
131
+ define_method("#{plural_name}_total_count") do
132
+ @object_handler.api_connector.handler(
133
+ Object.const_get(klass)
134
+ ).index_total_count(self)
135
+ end
136
+
137
+ define_method("all_#{plural_name}") do |params = {}, &block|
138
+ @object_handler.api_connector.handler(
139
+ Object.const_get(klass)
140
+ ).index_block(self.class, @id, params, &block)
141
+ end
142
+ end
143
+
144
+ def define_create_method(singular_name, klass)
145
+ define_method("create_#{singular_name}") do |create_attributes|
146
+ @object_handler.api_connector.handler(Object.const_get(klass)).create(self, create_attributes)
125
147
  end
126
148
  end
127
149
  end
@@ -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,32 @@ module PlateApi
13
10
 
14
11
  def extra_builder_options(builder)
15
12
  builder.request :multipart
16
- builder.request :url_encoded
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
+ begin
22
+ IO.popen(["file", "--brief", "--mime-type", full_path], in: :close, err: :close) { |io| io.read.chomp }
23
+ rescue SystemCallError
24
+ # determine mime_type based on extension as a fallback, in case `file` is not installed on the client machine
25
+ mime_type_fallback(full_path)
26
+ end
27
+ end
28
+
29
+ def mime_type_fallback(full_path)
30
+ MIME::Types.type_for(full_path).first.content_type
31
+ end
32
+
23
33
  def map_parameters(parameters)
24
34
  parameters.keys.each do |key|
25
35
  val = parameters[key]
26
36
  if val.is_a? File
27
37
  full_path = File.expand_path(val)
28
- mime_type = MimeMagic.by_path(full_path).type
38
+ mime_type = mime_type(full_path)
29
39
  parameters[key] = Faraday::UploadIO.new(full_path, mime_type)
30
40
  end
31
41
  end
@@ -1,22 +1,22 @@
1
1
  require "faraday"
2
2
  # require 'faraday_middleware'
3
- require 'time'
3
+ require "time"
4
4
  require "base64"
5
5
  require "openssl"
6
6
  require "json"
7
-
7
+ require "mime-types"
8
8
 
9
9
  module PlateApi
10
10
  class Request
11
11
  DefaultApiBaseEndpoint = "https://www.startwithplate.com/api/v2"
12
12
  HttpAdapter = Faraday.default_adapter
13
13
 
14
- def initialize(public_key, secret, method, path, custom_server=nil)
14
+ def initialize(public_key, secret, method, path, custom_server = nil)
15
15
  base_api_endpoint = custom_server ? custom_server : DefaultApiBaseEndpoint
16
16
 
17
17
  @connection = ::Faraday.new(url: base_api_endpoint) do |faraday|
18
18
  extra_builder_options(faraday)
19
- faraday.adapter HttpAdapter
19
+ faraday.adapter HttpAdapter
20
20
  end
21
21
 
22
22
  @public_key = public_key
@@ -25,20 +25,20 @@ module PlateApi
25
25
  @path = strip_path(path)
26
26
  end
27
27
 
28
- def execute(response_type=:raw)
28
+ def execute(response_type = :raw)
29
29
  response = @connection.send(@method.downcase) do |request|
30
30
  request.url url_path
31
- request.headers['Date'] = request_date
32
- request.headers['Authorization'] = calculate_signature
31
+ request.headers["Date"] = request_date
32
+ request.headers["Authorization"] = calculate_signature
33
33
  extra_request_options(request)
34
34
  end
35
35
 
36
36
  return case response_type
37
- when :raw
38
- return response.body
39
- when :json
40
- return JSON.parse(response.body)
41
- end
37
+ when :raw
38
+ return response.body
39
+ when :json
40
+ return JSON.parse(response.body)
41
+ end
42
42
  end
43
43
 
44
44
  def request_date
@@ -72,7 +72,7 @@ module PlateApi
72
72
  end
73
73
 
74
74
  def strip_path(path)
75
- path.gsub(/^\/|\/$/, '')
75
+ path.gsub(/^\/|\/$/, "")
76
76
  end
77
77
  end
78
78
  end
@@ -0,0 +1,5 @@
1
+ module PlateApi
2
+ class ResponseError < StandardError
3
+
4
+ end
5
+ end
@@ -1,3 +1,3 @@
1
1
  module PlateApi
2
- VERSION = "1.1.8"
2
+ VERSION = "1.2.5"
3
3
  end
data/lib/plate_api.rb CHANGED
@@ -9,6 +9,7 @@ require "plate_api/delete_request"
9
9
  require "plate_api/post_request"
10
10
  require "plate_api/post_multipart_request"
11
11
  require "plate_api/put_request"
12
+ require "plate_api/response_error"
12
13
 
13
14
 
14
15
  module PlateApi
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 = 'plate_api'
8
- spec.version = PlateApi::VERSION
9
- spec.date = '2019-01-05'
10
- spec.summary = "Connector for the Plate API"
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 = ["David Kortleven", "Harmen Fuite"]
15
- spec.email = ['david@getplate.com', 'harmen@getplate.com']
16
- spec.files = ["lib/plate_api.rb"]
17
- spec.license = 'MIT'
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,20 @@ 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
- "public gem pushes."
24
+ "public gem pushes."
26
25
  end
27
26
 
28
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
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 = "exe"
32
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
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"
35
+ spec.add_dependency "mime-types", "~> 3.3.1"
36
36
  # spec.add_dependency "faraday_middleware", "~> 0.13.1"
37
- spec.add_dependency "mimemagic", "~> 0.3.3"
37
+ # spec.add_dependency "mimemagic", "~> 0.3.10"
38
38
 
39
39
  spec.add_development_dependency "bundler", "~> 2.1.4"
40
40
  spec.add_development_dependency "rake", "~> 13.0"
@@ -44,5 +44,4 @@ Gem::Specification.new do |spec|
44
44
  spec.add_development_dependency "simplecov"
45
45
  spec.add_development_dependency "simplecov-console"
46
46
  spec.add_development_dependency "byebug"
47
-
48
47
  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.1.8
4
+ version: 1.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Kortleven
@@ -26,19 +26,19 @@ dependencies:
26
26
  - !ruby/object:Gem::Version
27
27
  version: 1.0.1
28
28
  - !ruby/object:Gem::Dependency
29
- name: mimemagic
29
+ name: mime-types
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: 0.3.3
34
+ version: 3.3.1
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: 0.3.3
41
+ version: 3.3.1
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: bundler
44
44
  requirement: !ruby/object:Gem::Requirement
@@ -165,6 +165,7 @@ files:
165
165
  - ".gitignore"
166
166
  - ".rspec"
167
167
  - ".travis.yml"
168
+ - Dockerfile
168
169
  - Gemfile
169
170
  - Gemfile.lock
170
171
  - LICENSE.txt
@@ -195,6 +196,7 @@ files:
195
196
  - lib/plate_api/post_request.rb
196
197
  - lib/plate_api/put_request.rb
197
198
  - lib/plate_api/request.rb
199
+ - lib/plate_api/response_error.rb
198
200
  - lib/plate_api/version.rb
199
201
  - plate_api.gemspec
200
202
  homepage: