plate_api 1.1.3 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.byebug_history +5 -0
- data/Gemfile +3 -4
- data/Gemfile.lock +43 -44
- data/lib/plate_api.rb +2 -1
- data/lib/plate_api/connector.rb +1 -0
- data/lib/plate_api/error.rb +5 -0
- data/lib/plate_api/object_handler.rb +17 -23
- data/lib/plate_api/plate_object/content_object.rb +15 -0
- data/lib/plate_api/plate_object/partner.rb +1 -0
- data/lib/plate_api/plate_object/site.rb +1 -0
- data/lib/plate_api/plate_object/site_translations.rb +1 -0
- data/lib/plate_api/post_multipart_request.rb +1 -0
- data/lib/plate_api/request.rb +1 -1
- data/lib/plate_api/version.rb +1 -1
- data/plate_api.gemspec +7 -7
- metadata +17 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4adf706bf694ce9826fd9ed0e2b6a5376038cb7efd99167bebddee74bf2ff2b
|
4
|
+
data.tar.gz: a90b502c510ca13f87e464ba026ab53ad16737f77ad6954d23b075afcfbc0bea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a84c77342116a513c6e8f16b62b9059ef069afe29910d7e5aa74abfc14e94da3328f1f80a31c4633ff9320c4e454dd81e63e48a0c29919664636af92e5ebdd1d
|
7
|
+
data.tar.gz: b0a78eab66e3da0a6e0b7350c80bb624f35b01e56bdd703b63997404a2e929282155acd9b5d2c86ba1d9d5d06909a04c44286dafb050c7b6d57921dd96790546
|
data/.byebug_history
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,88 +1,87 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
plate_api (1.
|
5
|
-
faraday (~> 0.
|
6
|
-
faraday_middleware (~> 0.13.1)
|
4
|
+
plate_api (1.2.0)
|
5
|
+
faraday (~> 1.0.1)
|
7
6
|
mimemagic (~> 0.3.3)
|
8
7
|
|
9
8
|
GEM
|
10
9
|
remote: https://rubygems.org/
|
11
10
|
specs:
|
12
|
-
activesupport (
|
11
|
+
activesupport (6.0.3.1)
|
13
12
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
13
|
i18n (>= 0.7, < 2)
|
15
14
|
minitest (~> 5.1)
|
16
15
|
tzinfo (~> 1.1)
|
17
|
-
|
18
|
-
|
16
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
17
|
+
addressable (2.7.0)
|
18
|
+
public_suffix (>= 2.0.2, < 5.0)
|
19
19
|
ansi (1.5.0)
|
20
|
-
byebug (11.
|
21
|
-
concurrent-ruby (1.1.
|
20
|
+
byebug (11.1.3)
|
21
|
+
concurrent-ruby (1.1.6)
|
22
22
|
crack (0.4.3)
|
23
23
|
safe_yaml (~> 1.0.0)
|
24
24
|
diff-lcs (1.3)
|
25
|
-
docile (1.3.
|
26
|
-
factory_bot (5.0.
|
25
|
+
docile (1.3.2)
|
26
|
+
factory_bot (5.0.2)
|
27
27
|
activesupport (>= 4.2.0)
|
28
|
-
faraday (0.
|
28
|
+
faraday (1.0.1)
|
29
29
|
multipart-post (>= 1.2, < 3)
|
30
|
-
|
31
|
-
|
32
|
-
hashdiff (0.3.8)
|
33
|
-
hirb (0.7.3)
|
34
|
-
i18n (1.5.3)
|
30
|
+
hashdiff (1.0.1)
|
31
|
+
i18n (1.8.2)
|
35
32
|
concurrent-ruby (~> 1.0)
|
36
|
-
|
37
|
-
|
38
|
-
minitest (5.11.3)
|
33
|
+
mimemagic (0.3.5)
|
34
|
+
minitest (5.14.1)
|
39
35
|
multipart-post (2.1.1)
|
40
|
-
public_suffix (
|
41
|
-
rake (
|
42
|
-
rspec (3.
|
43
|
-
rspec-core (~> 3.
|
44
|
-
rspec-expectations (~> 3.
|
45
|
-
rspec-mocks (~> 3.
|
46
|
-
rspec-core (3.
|
47
|
-
rspec-support (~> 3.
|
48
|
-
rspec-expectations (3.
|
36
|
+
public_suffix (4.0.5)
|
37
|
+
rake (13.0.1)
|
38
|
+
rspec (3.9.0)
|
39
|
+
rspec-core (~> 3.9.0)
|
40
|
+
rspec-expectations (~> 3.9.0)
|
41
|
+
rspec-mocks (~> 3.9.0)
|
42
|
+
rspec-core (3.9.2)
|
43
|
+
rspec-support (~> 3.9.3)
|
44
|
+
rspec-expectations (3.9.2)
|
49
45
|
diff-lcs (>= 1.2.0, < 2.0)
|
50
|
-
rspec-support (~> 3.
|
51
|
-
rspec-mocks (3.
|
46
|
+
rspec-support (~> 3.9.0)
|
47
|
+
rspec-mocks (3.9.1)
|
52
48
|
diff-lcs (>= 1.2.0, < 2.0)
|
53
|
-
rspec-support (~> 3.
|
54
|
-
rspec-support (3.
|
49
|
+
rspec-support (~> 3.9.0)
|
50
|
+
rspec-support (3.9.3)
|
55
51
|
safe_yaml (1.0.5)
|
56
|
-
simplecov (0.
|
52
|
+
simplecov (0.18.5)
|
57
53
|
docile (~> 1.1)
|
58
|
-
|
59
|
-
|
60
|
-
simplecov-console (0.4.2)
|
54
|
+
simplecov-html (~> 0.11)
|
55
|
+
simplecov-console (0.7.2)
|
61
56
|
ansi
|
62
|
-
hirb
|
63
57
|
simplecov
|
64
|
-
|
58
|
+
terminal-table
|
59
|
+
simplecov-html (0.12.2)
|
60
|
+
terminal-table (1.8.0)
|
61
|
+
unicode-display_width (~> 1.1, >= 1.1.1)
|
65
62
|
thread_safe (0.3.6)
|
66
|
-
tzinfo (1.2.
|
63
|
+
tzinfo (1.2.7)
|
67
64
|
thread_safe (~> 0.1)
|
68
|
-
|
65
|
+
unicode-display_width (1.7.0)
|
66
|
+
webmock (3.8.3)
|
69
67
|
addressable (>= 2.3.6)
|
70
68
|
crack (>= 0.3.2)
|
71
|
-
hashdiff
|
69
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
70
|
+
zeitwerk (2.3.0)
|
72
71
|
|
73
72
|
PLATFORMS
|
74
73
|
ruby
|
75
74
|
|
76
75
|
DEPENDENCIES
|
77
|
-
bundler (~> 1.
|
76
|
+
bundler (~> 2.1.4)
|
78
77
|
byebug
|
79
78
|
factory_bot (~> 5.0.1)
|
80
79
|
plate_api!
|
81
|
-
rake (~>
|
80
|
+
rake (~> 13.0)
|
82
81
|
rspec (~> 3.0)
|
83
82
|
simplecov
|
84
83
|
simplecov-console
|
85
84
|
webmock (~> 3.0)
|
86
85
|
|
87
86
|
BUNDLED WITH
|
88
|
-
1.
|
87
|
+
2.1.4
|
data/lib/plate_api.rb
CHANGED
@@ -9,10 +9,11 @@ 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/error"
|
12
13
|
|
13
14
|
|
14
15
|
module PlateApi
|
15
|
-
def self.new(public_key,
|
16
|
+
def self.new(public_key, secret_key)
|
16
17
|
PlateApi::Connector.new(public_key, secret_key)
|
17
18
|
end
|
18
19
|
end
|
data/lib/plate_api/connector.rb
CHANGED
@@ -5,39 +5,37 @@ module PlateApi
|
|
5
5
|
attr_reader :handling_class
|
6
6
|
|
7
7
|
def initialize(handling_class, api_connector)
|
8
|
-
raise ArgumentError
|
9
|
-
raise ArgumentError
|
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
|
@handling_class = handling_class
|
11
11
|
@api_connector = api_connector
|
12
12
|
end
|
13
13
|
|
14
14
|
def find(id)
|
15
|
-
raise ArgumentError
|
15
|
+
raise ArgumentError, "`id` given for #find is not valid" unless id
|
16
16
|
result = @api_connector.get(resource_path(id))
|
17
17
|
if result["data"]
|
18
18
|
return new_object(result["data"])
|
19
19
|
else
|
20
|
-
|
21
|
-
return nil
|
20
|
+
raise Error::Response, result
|
22
21
|
end
|
23
22
|
end
|
24
23
|
|
25
24
|
def update(id, attributes)
|
26
|
-
raise ArgumentError
|
27
|
-
raise ArgumentError
|
25
|
+
raise ArgumentError, "`id` given for #update is not valid" unless id
|
26
|
+
raise ArgumentError, "`attributes` given for #update is not valid" unless attributes.is_a? Hash
|
28
27
|
result = @api_connector.put(resource_path(id), {"data" => attributes})
|
29
28
|
|
30
29
|
if result["data"]
|
31
30
|
return new_object(result["data"])
|
32
31
|
else
|
33
|
-
|
34
|
-
return nil
|
32
|
+
raise Error::Response, result
|
35
33
|
end
|
36
34
|
end
|
37
35
|
|
38
36
|
def create(parent, attributes, create_method=:post)
|
39
|
-
raise ArgumentError
|
40
|
-
raise ArgumentError
|
37
|
+
raise ArgumentError, "`parent` given for #create is not valid" unless parent
|
38
|
+
raise ArgumentError, "`attributes` given for #create is not valid" unless attributes.is_a? Hash
|
41
39
|
parameters = case create_method
|
42
40
|
when :post
|
43
41
|
{"data" => attributes}
|
@@ -50,32 +48,29 @@ module PlateApi
|
|
50
48
|
if result["data"]
|
51
49
|
return new_object(result["data"])
|
52
50
|
else
|
53
|
-
|
54
|
-
return nil
|
51
|
+
raise Error::Response, result
|
55
52
|
end
|
56
53
|
end
|
57
54
|
|
58
55
|
def delete(id)
|
59
|
-
raise ArgumentError
|
56
|
+
raise ArgumentError, "`id` given for #find is not valid" unless id
|
60
57
|
result = @api_connector.delete(resource_path(id))
|
61
58
|
if result["data"]
|
62
59
|
return new_object(result["data"])
|
63
60
|
else
|
64
|
-
|
65
|
-
return nil
|
61
|
+
raise Error::Response, result
|
66
62
|
end
|
67
63
|
end
|
68
64
|
|
69
65
|
def index(parent_class, parent_id, extra_params={})
|
70
|
-
raise ArgumentError
|
71
|
-
raise ArgumentError
|
66
|
+
raise ArgumentError, "`parent_id` given for #index is not valid" unless parent_id
|
67
|
+
raise ArgumentError, "`parent_class` given for #index is not valid" unless parent_class
|
72
68
|
|
73
69
|
result = @api_connector.get(collection_path(parent_class, parent_id), extra_params)
|
74
70
|
if result["data"]
|
75
71
|
return result["data"].map{|x| new_object(x)}
|
76
72
|
else
|
77
|
-
|
78
|
-
return nil
|
73
|
+
raise Error::Response, result
|
79
74
|
end
|
80
75
|
end
|
81
76
|
|
@@ -84,8 +79,7 @@ module PlateApi
|
|
84
79
|
if result["meta"]
|
85
80
|
return result["meta"]["pagination"]["total_records"]
|
86
81
|
else
|
87
|
-
|
88
|
-
return nil
|
82
|
+
raise Error::Response, result
|
89
83
|
end
|
90
84
|
end
|
91
85
|
|
@@ -107,7 +101,7 @@ module PlateApi
|
|
107
101
|
|
108
102
|
def collection_path(parent_class=nil, parent_id=nil)
|
109
103
|
if (parent_class != nil) ^ (parent_id != nil)
|
110
|
-
raise ArgumentError
|
104
|
+
raise ArgumentError, "An invalid combination `parent_class` and `parent_id` is given. Provide both or none."
|
111
105
|
end
|
112
106
|
|
113
107
|
if parent_class
|
@@ -9,6 +9,7 @@ module PlateApi::PlateObject
|
|
9
9
|
has_many :rows, :row, "PlateApi::PlateObject::Row"
|
10
10
|
has_many :columns, :column, "PlateApi::PlateObject::Column"
|
11
11
|
has_many :elements, :element, "PlateApi::PlateObject::Element"
|
12
|
+
has_many :content_objects, :content_object, "PlateApi::PlateObject::ContentObject"
|
12
13
|
has_many :attachment_folders, :attachment_folder, "PlateApi::PlateObject::AttachmentFolder"
|
13
14
|
has_many :attachments, :attachment, "PlateApi::PlateObject::Attachment"
|
14
15
|
|
@@ -7,6 +7,7 @@ module PlateApi::PlateObject
|
|
7
7
|
has_many :rows, :row, "PlateApi::PlateObject::Row"
|
8
8
|
has_many :columns, :column, "PlateApi::PlateObject::Column"
|
9
9
|
has_many :elements, :element, "PlateApi::PlateObject::Element"
|
10
|
+
has_many :content_objects, :content_object, "PlateApi::PlateObject::ContentObject"
|
10
11
|
|
11
12
|
def self.api_name
|
12
13
|
"site_translations"
|
@@ -3,6 +3,7 @@ require 'mimemagic'
|
|
3
3
|
module PlateApi
|
4
4
|
class PostMultipartRequest < Request
|
5
5
|
HttpAdapter = :net_http
|
6
|
+
MimeMagic.add('image/jpeg', extensions: "jfif")
|
6
7
|
|
7
8
|
def initialize(public_key, secret, path, parameters={}, custom_server=nil)
|
8
9
|
super(public_key, secret, "POST", path, custom_server)
|
data/lib/plate_api/request.rb
CHANGED
data/lib/plate_api/version.rb
CHANGED
data/plate_api.gemspec
CHANGED
@@ -8,11 +8,11 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = PlateApi::VERSION
|
9
9
|
spec.date = '2019-01-05'
|
10
10
|
spec.summary = "Connector for the Plate API"
|
11
|
-
spec.description = "This gem can be used to connect to the Plate API. It takes care
|
11
|
+
spec.description = "This gem can be used to connect to the Plate API. It takes care
|
12
12
|
of the authentication procedure. It also provides a basic wrapper around the Plate API,
|
13
13
|
so objects in Plate can be manipulated as local objects."
|
14
|
-
spec.authors = ["David Kortleven"]
|
15
|
-
spec.email = 'david@getplate.com'
|
14
|
+
spec.authors = ["David Kortleven", "Harmen Fuite"]
|
15
|
+
spec.email = ['david@getplate.com', 'harmen@getplate.com']
|
16
16
|
spec.files = ["lib/plate_api.rb"]
|
17
17
|
spec.license = 'MIT'
|
18
18
|
|
@@ -32,12 +32,12 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
33
33
|
spec.require_paths = ["lib"]
|
34
34
|
|
35
|
-
spec.add_dependency "faraday", "~> 0.
|
36
|
-
spec.add_dependency "faraday_middleware", "~> 0.13.1"
|
35
|
+
spec.add_dependency "faraday", "~> 1.0.1"
|
36
|
+
# spec.add_dependency "faraday_middleware", "~> 0.13.1"
|
37
37
|
spec.add_dependency "mimemagic", "~> 0.3.3"
|
38
38
|
|
39
|
-
spec.add_development_dependency "bundler", "~> 1.
|
40
|
-
spec.add_development_dependency "rake", "~>
|
39
|
+
spec.add_development_dependency "bundler", "~> 2.1.4"
|
40
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
41
41
|
spec.add_development_dependency "rspec", "~> 3.0"
|
42
42
|
spec.add_development_dependency "webmock", "~> 3.0"
|
43
43
|
spec.add_development_dependency "factory_bot", "~> 5.0.1"
|
metadata
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: plate_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Kortleven
|
8
|
+
- Harmen Fuite
|
8
9
|
autorequire:
|
9
10
|
bindir: exe
|
10
11
|
cert_chain: []
|
@@ -16,28 +17,14 @@ dependencies:
|
|
16
17
|
requirements:
|
17
18
|
- - "~>"
|
18
19
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
20
|
+
version: 1.0.1
|
20
21
|
type: :runtime
|
21
22
|
prerelease: false
|
22
23
|
version_requirements: !ruby/object:Gem::Requirement
|
23
24
|
requirements:
|
24
25
|
- - "~>"
|
25
26
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: faraday_middleware
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 0.13.1
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: 0.13.1
|
27
|
+
version: 1.0.1
|
41
28
|
- !ruby/object:Gem::Dependency
|
42
29
|
name: mimemagic
|
43
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,28 +45,28 @@ dependencies:
|
|
58
45
|
requirements:
|
59
46
|
- - "~>"
|
60
47
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
48
|
+
version: 2.1.4
|
62
49
|
type: :development
|
63
50
|
prerelease: false
|
64
51
|
version_requirements: !ruby/object:Gem::Requirement
|
65
52
|
requirements:
|
66
53
|
- - "~>"
|
67
54
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
55
|
+
version: 2.1.4
|
69
56
|
- !ruby/object:Gem::Dependency
|
70
57
|
name: rake
|
71
58
|
requirement: !ruby/object:Gem::Requirement
|
72
59
|
requirements:
|
73
60
|
- - "~>"
|
74
61
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
62
|
+
version: '13.0'
|
76
63
|
type: :development
|
77
64
|
prerelease: false
|
78
65
|
version_requirements: !ruby/object:Gem::Requirement
|
79
66
|
requirements:
|
80
67
|
- - "~>"
|
81
68
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
69
|
+
version: '13.0'
|
83
70
|
- !ruby/object:Gem::Dependency
|
84
71
|
name: rspec
|
85
72
|
requirement: !ruby/object:Gem::Requirement
|
@@ -164,11 +151,12 @@ dependencies:
|
|
164
151
|
- - ">="
|
165
152
|
- !ruby/object:Gem::Version
|
166
153
|
version: '0'
|
167
|
-
description:
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
154
|
+
description: "This gem can be used to connect to the Plate API. It takes care \n of
|
155
|
+
the authentication procedure. It also provides a basic wrapper around the Plate
|
156
|
+
API,\n so objects in Plate can be manipulated as local objects."
|
157
|
+
email:
|
158
|
+
- david@getplate.com
|
159
|
+
- harmen@getplate.com
|
172
160
|
executables: []
|
173
161
|
extensions: []
|
174
162
|
extra_rdoc_files: []
|
@@ -187,6 +175,7 @@ files:
|
|
187
175
|
- lib/plate_api.rb
|
188
176
|
- lib/plate_api/connector.rb
|
189
177
|
- lib/plate_api/delete_request.rb
|
178
|
+
- lib/plate_api/error.rb
|
190
179
|
- lib/plate_api/get_request.rb
|
191
180
|
- lib/plate_api/object_handler.rb
|
192
181
|
- lib/plate_api/plate_object/attachment.rb
|
@@ -194,6 +183,7 @@ files:
|
|
194
183
|
- lib/plate_api/plate_object/base.rb
|
195
184
|
- lib/plate_api/plate_object/column.rb
|
196
185
|
- lib/plate_api/plate_object/company.rb
|
186
|
+
- lib/plate_api/plate_object/content_object.rb
|
197
187
|
- lib/plate_api/plate_object/element.rb
|
198
188
|
- lib/plate_api/plate_object/partner.rb
|
199
189
|
- lib/plate_api/plate_object/post.rb
|
@@ -228,8 +218,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
228
218
|
- !ruby/object:Gem::Version
|
229
219
|
version: '0'
|
230
220
|
requirements: []
|
231
|
-
|
232
|
-
rubygems_version: 2.7.6
|
221
|
+
rubygems_version: 3.1.2
|
233
222
|
signing_key:
|
234
223
|
specification_version: 4
|
235
224
|
summary: Connector for the Plate API
|