ecoportal-api-oozes 0.5.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +20 -0
- data/.rspec +3 -0
- data/.rubocop.yml +55 -0
- data/.travis.yml +5 -0
- data/.yardopts +10 -0
- data/Gemfile +6 -0
- data/LICENSE +21 -0
- data/README.md +20 -0
- data/Rakefile +27 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/ecoportal-api-oozes.gemspec +31 -0
- data/lib/ecoportal/api-oozes.rb +10 -0
- data/lib/ecoportal/api/common.rb +18 -0
- data/lib/ecoportal/api/common/content.rb +18 -0
- data/lib/ecoportal/api/common/content/array_model.rb +287 -0
- data/lib/ecoportal/api/common/content/class_helpers.rb +111 -0
- data/lib/ecoportal/api/common/content/client.rb +40 -0
- data/lib/ecoportal/api/common/content/collection_model.rb +223 -0
- data/lib/ecoportal/api/common/content/doc_helpers.rb +67 -0
- data/lib/ecoportal/api/common/content/double_model.rb +334 -0
- data/lib/ecoportal/api/common/content/hash_diff_patch.rb +162 -0
- data/lib/ecoportal/api/common/content/string_digest.rb +22 -0
- data/lib/ecoportal/api/common/content/wrapped_response.rb +42 -0
- data/lib/ecoportal/api/v2.rb +48 -0
- data/lib/ecoportal/api/v2/page.rb +30 -0
- data/lib/ecoportal/api/v2/page/component.rb +105 -0
- data/lib/ecoportal/api/v2/page/component/action.rb +17 -0
- data/lib/ecoportal/api/v2/page/component/action_field.rb +16 -0
- data/lib/ecoportal/api/v2/page/component/checklist_field.rb +16 -0
- data/lib/ecoportal/api/v2/page/component/checklist_item.rb +15 -0
- data/lib/ecoportal/api/v2/page/component/date_field.rb +13 -0
- data/lib/ecoportal/api/v2/page/component/file.rb +16 -0
- data/lib/ecoportal/api/v2/page/component/files_field.rb +14 -0
- data/lib/ecoportal/api/v2/page/component/gauge_field.rb +13 -0
- data/lib/ecoportal/api/v2/page/component/geo_field.rb +13 -0
- data/lib/ecoportal/api/v2/page/component/image.rb +16 -0
- data/lib/ecoportal/api/v2/page/component/images_field.rb +14 -0
- data/lib/ecoportal/api/v2/page/component/law_field.rb +12 -0
- data/lib/ecoportal/api/v2/page/component/number_field.rb +12 -0
- data/lib/ecoportal/api/v2/page/component/people_field.rb +13 -0
- data/lib/ecoportal/api/v2/page/component/plain_text_field.rb +13 -0
- data/lib/ecoportal/api/v2/page/component/reference_field.rb +12 -0
- data/lib/ecoportal/api/v2/page/component/rich_text_field.rb +13 -0
- data/lib/ecoportal/api/v2/page/component/selection_field.rb +18 -0
- data/lib/ecoportal/api/v2/page/component/selection_option.rb +15 -0
- data/lib/ecoportal/api/v2/page/component/signature_field.rb +14 -0
- data/lib/ecoportal/api/v2/page/component/tag_field.rb +12 -0
- data/lib/ecoportal/api/v2/page/components.rb +20 -0
- data/lib/ecoportal/api/v2/page/section.rb +36 -0
- data/lib/ecoportal/api/v2/page/sections.rb +14 -0
- data/lib/ecoportal/api/v2/page/stage.rb +16 -0
- data/lib/ecoportal/api/v2/page/stages.rb +14 -0
- data/lib/ecoportal/api/v2/pages.rb +63 -0
- data/lib/ecoportal/api/v2/register.rb +36 -0
- data/lib/ecoportal/api/v2/registers.rb +35 -0
- data/lib/ecoportal/api/v2/template.rb +10 -0
- data/lib/ecoportal/api/v2/version.rb +7 -0
- metadata +219 -0
@@ -0,0 +1,36 @@
|
|
1
|
+
module Ecoportal
|
2
|
+
module API
|
3
|
+
class V2
|
4
|
+
class Register < Common::Content::DoubleModel
|
5
|
+
passkey :id
|
6
|
+
passthrough :name
|
7
|
+
|
8
|
+
class_resolver :template_class, "Ecoportal::API::V2::Template"
|
9
|
+
|
10
|
+
def templates_by_id
|
11
|
+
@templates_by_id or index_templates
|
12
|
+
@templates_by_id
|
13
|
+
end
|
14
|
+
|
15
|
+
def [](id)
|
16
|
+
templates_by_id[id]
|
17
|
+
end
|
18
|
+
|
19
|
+
def templates
|
20
|
+
templates_by_id.values
|
21
|
+
end
|
22
|
+
|
23
|
+
def index_templates
|
24
|
+
@templates_by_id = {}
|
25
|
+
doc["templates"].each do |template_doc|
|
26
|
+
template = template_class.new(template_doc)
|
27
|
+
@templates_by_id[template.id] = template
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
require 'ecoportal/api/v2/template'
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Ecoportal
|
2
|
+
module API
|
3
|
+
class V2
|
4
|
+
class Registers
|
5
|
+
extend Common::BaseClass
|
6
|
+
include Enumerable
|
7
|
+
|
8
|
+
class_resolver :register_class, "Ecoportal::API::V2::Register"
|
9
|
+
|
10
|
+
attr_reader :client
|
11
|
+
|
12
|
+
# @param client [Common::Client] a `Common::Client` object that holds the configuration of the api connection.
|
13
|
+
# @return [Schemas] an instance object ready to make schema api requests.
|
14
|
+
def initialize(client)
|
15
|
+
@client = client
|
16
|
+
end
|
17
|
+
|
18
|
+
# Gets all the registers via api request.
|
19
|
+
# @return [Enumerable<Register>] an `Enumerable` with all schemas already wrapped as `Register` objects.
|
20
|
+
def get
|
21
|
+
response = client.get("/templates")
|
22
|
+
Common::Content::WrappedResponse.new(response, register_class, key: "registers")
|
23
|
+
end
|
24
|
+
|
25
|
+
def each(params: {}, &block)
|
26
|
+
return to_enum(:each) unless block
|
27
|
+
get.each(&block)
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
require 'ecoportal/api/v2/register'
|
metadata
ADDED
@@ -0,0 +1,219 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ecoportal-api-oozes
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.5.5
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Oscar Segura
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-03-30 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.1'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.1'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '12.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '12.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: yard
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.9'
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: 0.9.18
|
65
|
+
type: :development
|
66
|
+
prerelease: false
|
67
|
+
version_requirements: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - "~>"
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0.9'
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: 0.9.18
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: redcarpet
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: 3.5.0
|
82
|
+
- - "~>"
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '3.5'
|
85
|
+
type: :development
|
86
|
+
prerelease: false
|
87
|
+
version_requirements: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: 3.5.0
|
92
|
+
- - "~>"
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '3.5'
|
95
|
+
- !ruby/object:Gem::Dependency
|
96
|
+
name: pry
|
97
|
+
requirement: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - ">="
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '0'
|
109
|
+
- !ruby/object:Gem::Dependency
|
110
|
+
name: ecoportal-api
|
111
|
+
requirement: !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
113
|
+
- - "~>"
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '0.5'
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: 0.5.5
|
119
|
+
type: :runtime
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - "~>"
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0.5'
|
126
|
+
- - ">="
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: 0.5.5
|
129
|
+
description:
|
130
|
+
email:
|
131
|
+
- rien@ecoportal.co.nz
|
132
|
+
- oscar@ecoportal.co.nz
|
133
|
+
- bozydar@ecoportal.co.nz
|
134
|
+
executables: []
|
135
|
+
extensions: []
|
136
|
+
extra_rdoc_files: []
|
137
|
+
files:
|
138
|
+
- ".gitignore"
|
139
|
+
- ".rspec"
|
140
|
+
- ".rubocop.yml"
|
141
|
+
- ".travis.yml"
|
142
|
+
- ".yardopts"
|
143
|
+
- Gemfile
|
144
|
+
- LICENSE
|
145
|
+
- README.md
|
146
|
+
- Rakefile
|
147
|
+
- bin/console
|
148
|
+
- bin/setup
|
149
|
+
- ecoportal-api-oozes.gemspec
|
150
|
+
- lib/ecoportal/api-oozes.rb
|
151
|
+
- lib/ecoportal/api/common.rb
|
152
|
+
- lib/ecoportal/api/common/content.rb
|
153
|
+
- lib/ecoportal/api/common/content/array_model.rb
|
154
|
+
- lib/ecoportal/api/common/content/class_helpers.rb
|
155
|
+
- lib/ecoportal/api/common/content/client.rb
|
156
|
+
- lib/ecoportal/api/common/content/collection_model.rb
|
157
|
+
- lib/ecoportal/api/common/content/doc_helpers.rb
|
158
|
+
- lib/ecoportal/api/common/content/double_model.rb
|
159
|
+
- lib/ecoportal/api/common/content/hash_diff_patch.rb
|
160
|
+
- lib/ecoportal/api/common/content/string_digest.rb
|
161
|
+
- lib/ecoportal/api/common/content/wrapped_response.rb
|
162
|
+
- lib/ecoportal/api/v2.rb
|
163
|
+
- lib/ecoportal/api/v2/page.rb
|
164
|
+
- lib/ecoportal/api/v2/page/component.rb
|
165
|
+
- lib/ecoportal/api/v2/page/component/action.rb
|
166
|
+
- lib/ecoportal/api/v2/page/component/action_field.rb
|
167
|
+
- lib/ecoportal/api/v2/page/component/checklist_field.rb
|
168
|
+
- lib/ecoportal/api/v2/page/component/checklist_item.rb
|
169
|
+
- lib/ecoportal/api/v2/page/component/date_field.rb
|
170
|
+
- lib/ecoportal/api/v2/page/component/file.rb
|
171
|
+
- lib/ecoportal/api/v2/page/component/files_field.rb
|
172
|
+
- lib/ecoportal/api/v2/page/component/gauge_field.rb
|
173
|
+
- lib/ecoportal/api/v2/page/component/geo_field.rb
|
174
|
+
- lib/ecoportal/api/v2/page/component/image.rb
|
175
|
+
- lib/ecoportal/api/v2/page/component/images_field.rb
|
176
|
+
- lib/ecoportal/api/v2/page/component/law_field.rb
|
177
|
+
- lib/ecoportal/api/v2/page/component/number_field.rb
|
178
|
+
- lib/ecoportal/api/v2/page/component/people_field.rb
|
179
|
+
- lib/ecoportal/api/v2/page/component/plain_text_field.rb
|
180
|
+
- lib/ecoportal/api/v2/page/component/reference_field.rb
|
181
|
+
- lib/ecoportal/api/v2/page/component/rich_text_field.rb
|
182
|
+
- lib/ecoportal/api/v2/page/component/selection_field.rb
|
183
|
+
- lib/ecoportal/api/v2/page/component/selection_option.rb
|
184
|
+
- lib/ecoportal/api/v2/page/component/signature_field.rb
|
185
|
+
- lib/ecoportal/api/v2/page/component/tag_field.rb
|
186
|
+
- lib/ecoportal/api/v2/page/components.rb
|
187
|
+
- lib/ecoportal/api/v2/page/section.rb
|
188
|
+
- lib/ecoportal/api/v2/page/sections.rb
|
189
|
+
- lib/ecoportal/api/v2/page/stage.rb
|
190
|
+
- lib/ecoportal/api/v2/page/stages.rb
|
191
|
+
- lib/ecoportal/api/v2/pages.rb
|
192
|
+
- lib/ecoportal/api/v2/register.rb
|
193
|
+
- lib/ecoportal/api/v2/registers.rb
|
194
|
+
- lib/ecoportal/api/v2/template.rb
|
195
|
+
- lib/ecoportal/api/v2/version.rb
|
196
|
+
homepage: https://www.ecoportal.com
|
197
|
+
licenses:
|
198
|
+
- MIT
|
199
|
+
metadata: {}
|
200
|
+
post_install_message:
|
201
|
+
rdoc_options: []
|
202
|
+
require_paths:
|
203
|
+
- lib
|
204
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- - ">="
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: '0'
|
209
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
210
|
+
requirements:
|
211
|
+
- - ">="
|
212
|
+
- !ruby/object:Gem::Version
|
213
|
+
version: '0'
|
214
|
+
requirements: []
|
215
|
+
rubygems_version: 3.0.3
|
216
|
+
signing_key:
|
217
|
+
specification_version: 4
|
218
|
+
summary: A collection of helpers for interacting with the ecoPortal MS's V2 API
|
219
|
+
test_files: []
|