uploadcare-api_struct 1.1.0 → 1.2.0
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 +4 -4
- data/.github/workflows/gem-push.yml +20 -0
- data/.github/workflows/test.yml +55 -0
- data/.gitignore +1 -0
- data/CHANGELOG.md +7 -0
- data/README.md +10 -4
- data/lib/api_struct/entity.rb +6 -2
- data/lib/api_struct/version.rb +1 -1
- metadata +8 -8
- data/.circleci/config.yml +0 -25
- data/Gemfile.lock +0 -123
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8eb2b7c045a0c990be3854fab41ea556c8d5dfa5070d425fa757c2ba8cf2d6e5
|
4
|
+
data.tar.gz: 64e2f2575e71e1d7d4fdfccd8bcc132953bcca92a304f04d4867bdd7ff5731ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07fb630c0daf616f86bd2a0bb17e988edda456977ddb28437dc27db1df5da24bbf769436a0b4aaf46894d172ce644a59d391c85d42078a13301f0402e996767c
|
7
|
+
data.tar.gz: 875e932142896e08827d77d8c964a1cccbf3eb324fb5016ed9ed78faa5dfd0df6d0d41e0c9fa3bd41a3e26e7dd3b5009786ca367cadf050492b34b77fb77064c
|
@@ -0,0 +1,20 @@
|
|
1
|
+
name: Publish Gem
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
tags:
|
6
|
+
- v*
|
7
|
+
jobs:
|
8
|
+
build:
|
9
|
+
runs-on: ubuntu-latest
|
10
|
+
|
11
|
+
steps:
|
12
|
+
- uses: actions/checkout@v3
|
13
|
+
|
14
|
+
- name: Release Gem
|
15
|
+
if: contains(github.ref, 'refs/tags/v')
|
16
|
+
uses: cadwallion/publish-rubygems-action@master
|
17
|
+
env:
|
18
|
+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
19
|
+
RUBYGEMS_API_KEY: ${{secrets.RUBYGEMS_API_KEY}}
|
20
|
+
RELEASE_COMMAND: rake release
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
2
|
+
# They are provided by a third-party and are governed by
|
3
|
+
# separate terms of service, privacy policy, and support
|
4
|
+
# documentation.
|
5
|
+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
6
|
+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
7
|
+
|
8
|
+
name: Test
|
9
|
+
|
10
|
+
on: [push, pull_request]
|
11
|
+
|
12
|
+
jobs:
|
13
|
+
test:
|
14
|
+
|
15
|
+
runs-on: ubuntu-latest
|
16
|
+
strategy:
|
17
|
+
matrix:
|
18
|
+
ruby-version:
|
19
|
+
- 3.0
|
20
|
+
- 3.1
|
21
|
+
- 3.2
|
22
|
+
- 3.3
|
23
|
+
steps:
|
24
|
+
- uses: actions/checkout@v2
|
25
|
+
- name: Set up Ruby
|
26
|
+
uses: ruby/setup-ruby@v1
|
27
|
+
with:
|
28
|
+
bundler: 2.4
|
29
|
+
ruby-version: ${{ matrix.ruby-version }}
|
30
|
+
bundler-cache: true
|
31
|
+
- name: Run tests
|
32
|
+
run: bundle exec rake
|
33
|
+
env:
|
34
|
+
UPLOADCARE_PUBLIC_KEY: demopublickey
|
35
|
+
UPLOADCARE_SECRET_KEY: demoprivatekey
|
36
|
+
|
37
|
+
style-check:
|
38
|
+
runs-on: ubuntu-latest
|
39
|
+
continue-on-error: true
|
40
|
+
strategy:
|
41
|
+
matrix:
|
42
|
+
ruby-version:
|
43
|
+
- 3.0
|
44
|
+
- 3.3
|
45
|
+
steps:
|
46
|
+
- uses: actions/checkout@v2
|
47
|
+
- name: Set up Ruby
|
48
|
+
uses: ruby/setup-ruby@v1
|
49
|
+
with:
|
50
|
+
ruby-version: ${{ matrix.ruby-version }}
|
51
|
+
bundler-cache: true
|
52
|
+
- name: Install Rubocop
|
53
|
+
run: gem install rubocop
|
54
|
+
- name: Check codestyle
|
55
|
+
run: rubocop
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -2,16 +2,22 @@
|
|
2
2
|
|
3
3
|
**ApiStruct** consists of two main interfaces: `ApiStruct::Client` and `ApiStruct::Entity`. The `ApiStruct::Client` class is aimed at using the same interface for describing requests to different APIs. The `ApiStruct::Entity` enables you to use *ApiStruct* clients in ORM-like style.
|
4
4
|
|
5
|
-
[](https://badge.fury.io/rb/api_struct)
|
5
|
+
[](https://badge.fury.io/rb/uploadcare-api_struct)
|
6
6
|

|
7
|
-
[![
|
7
|
+
[![Build Status][actions-img]][actions-badge]
|
8
|
+
[![Coverage Status][coverals-img]][coverals]
|
9
|
+
|
10
|
+
[actions-badge]: https://github.com/uploadcare/uploadcare-api_struct/actions/workflows/test.yml
|
11
|
+
[actions-img]: https://github.com/uploadcare/uploadcare-api_struct/actions/workflows/test.yml/badge.svg
|
12
|
+
[coverals-img]: https://coveralls.io/repos/github/uploadcare/uploadcare-api_struct/badge.svg?branch=master
|
13
|
+
[coverals]: https://coveralls.io/github/uploadcare/uploadcare-api_struct?branch=master
|
8
14
|
|
9
15
|
## Installation
|
10
16
|
|
11
17
|
Add this line to your application's Gemfile:
|
12
18
|
|
13
19
|
```ruby
|
14
|
-
gem 'api_struct'
|
20
|
+
gem 'uploadcare-api_struct'
|
15
21
|
```
|
16
22
|
|
17
23
|
And then execute:
|
@@ -20,7 +26,7 @@ And then execute:
|
|
20
26
|
|
21
27
|
Or install it yourself as:
|
22
28
|
|
23
|
-
$ gem install api_struct
|
29
|
+
$ gem install uploadcare-api_struct
|
24
30
|
|
25
31
|
## Usage
|
26
32
|
|
data/lib/api_struct/entity.rb
CHANGED
@@ -28,7 +28,7 @@ module ApiStruct
|
|
28
28
|
def entity?(attr, options)
|
29
29
|
entity_attributes << attr.to_sym
|
30
30
|
define_method attr.to_s do
|
31
|
-
return unless entity[attr]
|
31
|
+
return false unless entity[attr]
|
32
32
|
self.class.convert_to_entity(entity[attr], options[:as])
|
33
33
|
end
|
34
34
|
end
|
@@ -60,10 +60,14 @@ module ApiStruct
|
|
60
60
|
|
61
61
|
attr_reader :entity, :entity_status
|
62
62
|
|
63
|
+
class EntityMash < Hashie::Mash
|
64
|
+
disable_warnings :size
|
65
|
+
end
|
66
|
+
|
63
67
|
# rubocop:disable Style/OptionalBooleanParameter
|
64
68
|
def initialize(entity, entity_status = true)
|
65
69
|
raise EntityError, "#{entity} must be Hash" unless entity.is_a?(Hash)
|
66
|
-
@entity =
|
70
|
+
@entity = EntityMash.new(extract_attributes(entity))
|
67
71
|
@entity_status = entity_status
|
68
72
|
__setobj__(@entity)
|
69
73
|
end
|
data/lib/api_struct/version.rb
CHANGED
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uploadcare-api_struct
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bezrukavyi
|
8
8
|
- andy1341
|
9
9
|
- kirillshevch
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2024-03-21 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: dry-monads
|
@@ -217,13 +217,13 @@ executables: []
|
|
217
217
|
extensions: []
|
218
218
|
extra_rdoc_files: []
|
219
219
|
files:
|
220
|
-
- ".
|
220
|
+
- ".github/workflows/gem-push.yml"
|
221
|
+
- ".github/workflows/test.yml"
|
221
222
|
- ".gitignore"
|
222
223
|
- ".rspec"
|
223
224
|
- ".rubocop.yml"
|
224
225
|
- CHANGELOG.md
|
225
226
|
- Gemfile
|
226
|
-
- Gemfile.lock
|
227
227
|
- LICENSE.txt
|
228
228
|
- README.md
|
229
229
|
- Rakefile
|
@@ -261,7 +261,7 @@ homepage: https://github.com/uploadcare/uploadcare-api_struct
|
|
261
261
|
licenses:
|
262
262
|
- MIT
|
263
263
|
metadata: {}
|
264
|
-
post_install_message:
|
264
|
+
post_install_message:
|
265
265
|
rdoc_options: []
|
266
266
|
require_paths:
|
267
267
|
- lib
|
@@ -276,8 +276,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
276
276
|
- !ruby/object:Gem::Version
|
277
277
|
version: '0'
|
278
278
|
requirements: []
|
279
|
-
rubygems_version: 3.
|
280
|
-
signing_key:
|
279
|
+
rubygems_version: 3.5.3
|
280
|
+
signing_key:
|
281
281
|
specification_version: 4
|
282
282
|
summary: API wrapper builder with response serialization
|
283
283
|
test_files: []
|
data/.circleci/config.yml
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
version: 2
|
2
|
-
jobs:
|
3
|
-
build:
|
4
|
-
docker:
|
5
|
-
- image: circleci/ruby:3.2-node
|
6
|
-
|
7
|
-
steps:
|
8
|
-
- checkout
|
9
|
-
|
10
|
-
- restore_cache:
|
11
|
-
keys:
|
12
|
-
- api-struct-bundle-v2-{{ checksum "api_struct.gemspec" }}
|
13
|
-
|
14
|
-
- run:
|
15
|
-
name: Bundle Install
|
16
|
-
command: bundle check || bundle install
|
17
|
-
|
18
|
-
- save_cache:
|
19
|
-
key: api-struct-bundle-v2-{{ checksum "api_struct.gemspec" }}
|
20
|
-
paths:
|
21
|
-
- vendor/bundle
|
22
|
-
|
23
|
-
- run:
|
24
|
-
name: Run Rspec
|
25
|
-
command: bundle exec rspec
|
data/Gemfile.lock
DELETED
@@ -1,123 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
api_struct (1.1.0)
|
5
|
-
dry-configurable (~> 1.0)
|
6
|
-
dry-inflector (~> 1.0)
|
7
|
-
dry-monads (~> 1.6)
|
8
|
-
hashie (~> 5.0)
|
9
|
-
http (~> 5.1)
|
10
|
-
|
11
|
-
GEM
|
12
|
-
remote: https://rubygems.org/
|
13
|
-
specs:
|
14
|
-
addressable (2.8.1)
|
15
|
-
public_suffix (>= 2.0.2, < 6.0)
|
16
|
-
ast (2.4.2)
|
17
|
-
byebug (11.1.3)
|
18
|
-
coderay (1.1.3)
|
19
|
-
concurrent-ruby (1.2.2)
|
20
|
-
crack (0.4.5)
|
21
|
-
rexml
|
22
|
-
diff-lcs (1.5.0)
|
23
|
-
domain_name (0.5.20190701)
|
24
|
-
unf (>= 0.0.5, < 1.0.0)
|
25
|
-
dry-configurable (1.0.1)
|
26
|
-
dry-core (~> 1.0, < 2)
|
27
|
-
zeitwerk (~> 2.6)
|
28
|
-
dry-core (1.0.0)
|
29
|
-
concurrent-ruby (~> 1.0)
|
30
|
-
zeitwerk (~> 2.6)
|
31
|
-
dry-inflector (1.0.0)
|
32
|
-
dry-monads (1.6.0)
|
33
|
-
concurrent-ruby (~> 1.0)
|
34
|
-
dry-core (~> 1.0, < 2)
|
35
|
-
zeitwerk (~> 2.6)
|
36
|
-
ffaker (2.21.0)
|
37
|
-
ffi (1.15.5)
|
38
|
-
ffi-compiler (1.0.1)
|
39
|
-
ffi (>= 1.0.0)
|
40
|
-
rake
|
41
|
-
hashdiff (1.0.1)
|
42
|
-
hashie (5.0.0)
|
43
|
-
http (5.1.1)
|
44
|
-
addressable (~> 2.8)
|
45
|
-
http-cookie (~> 1.0)
|
46
|
-
http-form_data (~> 2.2)
|
47
|
-
llhttp-ffi (~> 0.4.0)
|
48
|
-
http-cookie (1.0.5)
|
49
|
-
domain_name (~> 0.5)
|
50
|
-
http-form_data (2.3.0)
|
51
|
-
json (2.6.3)
|
52
|
-
llhttp-ffi (0.4.0)
|
53
|
-
ffi-compiler (~> 1.0)
|
54
|
-
rake (~> 13.0)
|
55
|
-
method_source (1.0.0)
|
56
|
-
parallel (1.22.1)
|
57
|
-
parser (3.2.1.1)
|
58
|
-
ast (~> 2.4.1)
|
59
|
-
pry (0.14.2)
|
60
|
-
coderay (~> 1.1)
|
61
|
-
method_source (~> 1.0)
|
62
|
-
pry-byebug (3.10.1)
|
63
|
-
byebug (~> 11.0)
|
64
|
-
pry (>= 0.13, < 0.15)
|
65
|
-
public_suffix (5.0.1)
|
66
|
-
rainbow (3.1.1)
|
67
|
-
rake (13.0.6)
|
68
|
-
regexp_parser (2.7.0)
|
69
|
-
rexml (3.2.5)
|
70
|
-
rspec (3.12.0)
|
71
|
-
rspec-core (~> 3.12.0)
|
72
|
-
rspec-expectations (~> 3.12.0)
|
73
|
-
rspec-mocks (~> 3.12.0)
|
74
|
-
rspec-core (3.12.1)
|
75
|
-
rspec-support (~> 3.12.0)
|
76
|
-
rspec-expectations (3.12.2)
|
77
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
78
|
-
rspec-support (~> 3.12.0)
|
79
|
-
rspec-mocks (3.12.4)
|
80
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
81
|
-
rspec-support (~> 3.12.0)
|
82
|
-
rspec-support (3.12.0)
|
83
|
-
rubocop (1.48.1)
|
84
|
-
json (~> 2.3)
|
85
|
-
parallel (~> 1.10)
|
86
|
-
parser (>= 3.2.0.0)
|
87
|
-
rainbow (>= 2.2.2, < 4.0)
|
88
|
-
regexp_parser (>= 1.8, < 3.0)
|
89
|
-
rexml (>= 3.2.5, < 4.0)
|
90
|
-
rubocop-ast (>= 1.26.0, < 2.0)
|
91
|
-
ruby-progressbar (~> 1.7)
|
92
|
-
unicode-display_width (>= 2.4.0, < 3.0)
|
93
|
-
rubocop-ast (1.27.0)
|
94
|
-
parser (>= 3.2.1.0)
|
95
|
-
ruby-progressbar (1.13.0)
|
96
|
-
unf (0.1.4)
|
97
|
-
unf_ext
|
98
|
-
unf_ext (0.0.8.2)
|
99
|
-
unicode-display_width (2.4.2)
|
100
|
-
vcr (6.1.0)
|
101
|
-
webmock (3.18.1)
|
102
|
-
addressable (>= 2.8.0)
|
103
|
-
crack (>= 0.3.2)
|
104
|
-
hashdiff (>= 0.4.0, < 2.0.0)
|
105
|
-
zeitwerk (2.6.7)
|
106
|
-
|
107
|
-
PLATFORMS
|
108
|
-
ruby
|
109
|
-
|
110
|
-
DEPENDENCIES
|
111
|
-
api_struct!
|
112
|
-
bundler (~> 2.4)
|
113
|
-
byebug (~> 11.1)
|
114
|
-
ffaker (~> 2.21)
|
115
|
-
pry-byebug (~> 3.10)
|
116
|
-
rake (~> 13.0)
|
117
|
-
rspec (~> 3.12)
|
118
|
-
rubocop (~> 1.48)
|
119
|
-
vcr (~> 6.1)
|
120
|
-
webmock (~> 3.18)
|
121
|
-
|
122
|
-
BUNDLED WITH
|
123
|
-
2.4.8
|