ecoportal-api 0.8.5 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +20 -20
  3. data/.rspec +3 -3
  4. data/.rubocop.yml +55 -55
  5. data/.travis.yml +5 -5
  6. data/.yardopts +10 -10
  7. data/CHANGELOG.md +257 -236
  8. data/Gemfile +6 -6
  9. data/LICENSE +21 -21
  10. data/README.md +34 -34
  11. data/Rakefile +27 -27
  12. data/bin/console +14 -14
  13. data/bin/setup +8 -8
  14. data/ecoportal-api.gemspec +36 -36
  15. data/lib/ecoportal/api/common/base_class.rb +33 -29
  16. data/lib/ecoportal/api/common/base_model.rb +195 -177
  17. data/lib/ecoportal/api/common/batch_operation.rb +119 -119
  18. data/lib/ecoportal/api/common/batch_response.rb +34 -34
  19. data/lib/ecoportal/api/common/client.rb +198 -196
  20. data/lib/ecoportal/api/common/doc_helpers.rb +29 -29
  21. data/lib/ecoportal/api/common/elastic_apm_integration.rb +112 -112
  22. data/lib/ecoportal/api/common/hash_diff.rb +41 -41
  23. data/lib/ecoportal/api/common/logging.rb +12 -12
  24. data/lib/ecoportal/api/common/response.rb +31 -31
  25. data/lib/ecoportal/api/common/wrapped_response.rb +54 -54
  26. data/lib/ecoportal/api/common.rb +18 -18
  27. data/lib/ecoportal/api/errors/base.rb +8 -8
  28. data/lib/ecoportal/api/errors/time_out.rb +8 -8
  29. data/lib/ecoportal/api/errors.rb +9 -9
  30. data/lib/ecoportal/api/internal/account.rb +99 -100
  31. data/lib/ecoportal/api/internal/login_provider.rb +9 -9
  32. data/lib/ecoportal/api/internal/login_providers.rb +33 -33
  33. data/lib/ecoportal/api/internal/people.rb +14 -14
  34. data/lib/ecoportal/api/internal/permissions.rb +14 -13
  35. data/lib/ecoportal/api/internal/person.rb +101 -53
  36. data/lib/ecoportal/api/internal/person_details.rb +9 -9
  37. data/lib/ecoportal/api/internal/person_schema.rb +10 -10
  38. data/lib/ecoportal/api/internal/person_schemas.rb +11 -11
  39. data/lib/ecoportal/api/internal/policy_group.rb +9 -9
  40. data/lib/ecoportal/api/internal/policy_groups.rb +32 -32
  41. data/lib/ecoportal/api/internal/preferences.rb +31 -31
  42. data/lib/ecoportal/api/internal/schema_field.rb +8 -8
  43. data/lib/ecoportal/api/internal/schema_field_value.rb +8 -8
  44. data/lib/ecoportal/api/internal.rb +31 -31
  45. data/lib/ecoportal/api/logger.rb +62 -62
  46. data/lib/ecoportal/api/v1/people.rb +218 -218
  47. data/lib/ecoportal/api/v1/person.rb +138 -135
  48. data/lib/ecoportal/api/v1/person_details.rb +94 -82
  49. data/lib/ecoportal/api/v1/person_schema.rb +53 -53
  50. data/lib/ecoportal/api/v1/person_schemas.rb +48 -48
  51. data/lib/ecoportal/api/v1/schema_field.rb +34 -34
  52. data/lib/ecoportal/api/v1/schema_field_value.rb +65 -65
  53. data/lib/ecoportal/api/v1.rb +49 -49
  54. data/lib/ecoportal/api/version.rb +5 -5
  55. data/lib/ecoportal/api.rb +16 -16
  56. metadata +3 -3
@@ -1,31 +1,31 @@
1
- module Ecoportal
2
- module API
3
- class Internal
4
- class Preferences < Common::BaseModel
5
- passthrough :kiosk_enabled, :kiosk_workflow_message, :kiosk_create_button_label,
6
- :kiosk_create_button_help, :kiosk_return_button_label, :kiosk_return_button_help,
7
- :kiosk_dashboard_button_label, :kiosk_dashboard_button_help
8
-
9
- [
10
- :show_sidebar,
11
- :show_shortcuts,
12
- :show_coming_soon,
13
- :show_recently_visited_forms,
14
- :show_tasks,
15
- :show_task_bubbles
16
- ].map(&:to_s).each do |field|
17
- define_method(field) do
18
- if doc.key?(field)
19
- doc[field]
20
- else
21
- true
22
- end
23
- end
24
- define_method("#{field}=") do |value|
25
- doc[field] = !!value
26
- end
27
- end
28
- end
29
- end
30
- end
31
- end
1
+ module Ecoportal
2
+ module API
3
+ class Internal
4
+ class Preferences < Common::BaseModel
5
+ passthrough :kiosk_enabled, :kiosk_workflow_message, :kiosk_create_button_label,
6
+ :kiosk_create_button_help, :kiosk_return_button_label, :kiosk_return_button_help,
7
+ :kiosk_dashboard_button_label, :kiosk_dashboard_button_help
8
+
9
+ [
10
+ :show_sidebar,
11
+ :show_shortcuts,
12
+ :show_coming_soon,
13
+ :show_recently_visited_forms,
14
+ :show_tasks,
15
+ :show_task_bubbles
16
+ ].map(&:to_s).each do |field|
17
+ define_method(field) do
18
+ if doc.key?(field)
19
+ doc[field]
20
+ else
21
+ true
22
+ end
23
+ end
24
+ define_method("#{field}=") do |value|
25
+ doc[field] = !!value
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -1,8 +1,8 @@
1
- module Ecoportal
2
- module API
3
- class Internal
4
- class SchemaField < V1::SchemaField
5
- end
6
- end
7
- end
8
- end
1
+ module Ecoportal
2
+ module API
3
+ class Internal
4
+ class SchemaField < V1::SchemaField
5
+ end
6
+ end
7
+ end
8
+ end
@@ -1,8 +1,8 @@
1
- module Ecoportal
2
- module API
3
- class Internal
4
- class SchemaFieldValue < V1::SchemaFieldValue
5
- end
6
- end
7
- end
8
- end
1
+ module Ecoportal
2
+ module API
3
+ class Internal
4
+ class SchemaFieldValue < V1::SchemaFieldValue
5
+ end
6
+ end
7
+ end
8
+ end
@@ -1,31 +1,31 @@
1
- module Ecoportal
2
- module API
3
- class Internal < V1
4
- include Common::Logging
5
-
6
- VERSION = "v0"
7
- class_resolver :people_class, "Ecoportal::API::Internal::People"
8
- class_resolver :person_schemas_class, "Ecoportal::API::Internal::PersonSchemas"
9
-
10
- class_resolver :policy_groups_class, "Ecoportal::API::Internal::PolicyGroups"
11
- class_resolver :login_providers_class, "Ecoportal::API::Internal::LoginProviders"
12
-
13
- # Obtain specific object for policy groups api requests.
14
- # @return [PolicyGroups] an instance object ready to make policy groups api requests.
15
- def policy_groups
16
- policy_groups_class.new(client)
17
- end
18
-
19
- # Obtain specific object for login providers api requests.
20
- # @return [LoginProviders] an instance object ready to make login providers api requests.
21
- def login_providers
22
- login_providers_class.new(client)
23
- end
24
- end
25
- end
26
- end
27
-
28
- require 'ecoportal/api/internal/person_schemas'
29
- require 'ecoportal/api/internal/policy_groups'
30
- require 'ecoportal/api/internal/login_providers'
31
- require 'ecoportal/api/internal/people'
1
+ module Ecoportal
2
+ module API
3
+ class Internal < V1
4
+ include Common::Logging
5
+
6
+ VERSION = "v0"
7
+ class_resolver :people_class, "Ecoportal::API::Internal::People"
8
+ class_resolver :person_schemas_class, "Ecoportal::API::Internal::PersonSchemas"
9
+
10
+ class_resolver :policy_groups_class, "Ecoportal::API::Internal::PolicyGroups"
11
+ class_resolver :login_providers_class, "Ecoportal::API::Internal::LoginProviders"
12
+
13
+ # Obtain specific object for policy groups api requests.
14
+ # @return [PolicyGroups] an instance object ready to make policy groups api requests.
15
+ def policy_groups
16
+ policy_groups_class.new(client)
17
+ end
18
+
19
+ # Obtain specific object for login providers api requests.
20
+ # @return [LoginProviders] an instance object ready to make login providers api requests.
21
+ def login_providers
22
+ login_providers_class.new(client)
23
+ end
24
+ end
25
+ end
26
+ end
27
+
28
+ require 'ecoportal/api/internal/person_schemas'
29
+ require 'ecoportal/api/internal/policy_groups'
30
+ require 'ecoportal/api/internal/login_providers'
31
+ require 'ecoportal/api/internal/people'
@@ -1,62 +1,62 @@
1
- module Ecoportal
2
- module API
3
- class Logger
4
- TIMESTAMP_PATTERN = "%Y-%m-%dT%H:%M:%S"
5
- STDOUT_FORMAT_PROC = proc do |severity, datetime, progname, msg|
6
- prefix = "%5s > " % severity
7
- msg.lines.map.with_index do |line, idx|
8
- if idx.zero?
9
- prefix + line.chomp
10
- else
11
- " "*prefix.length + line.chomp
12
- end
13
- end.join("\n")+"\n"
14
- end
15
- FILE_FORMAT_PROC = proc do |severity, datetime, progname, msg|
16
- prefix = "%5s(%s) > " % [severity, datetime.strftime(TIMESTAMP_PATTERN)]
17
- msg.lines.map.with_index do |line, idx|
18
- if idx.zero?
19
- prefix + line.chomp
20
- else
21
- " "*prefix.length + line.chomp
22
- end
23
- end.join("\n")+"\n"
24
- end
25
-
26
- attr_reader :console, :file
27
-
28
- def initialize(
29
- console_level: ::Logger::INFO,
30
- file_level: ::Logger::DEBUG,
31
- output_file: File.join(Dir.getwd, "API_Log-#{Time.now.strftime("%Y-%m-%dT%H%M")}.txt")
32
- )
33
- @console = make_stdout_logger(console_level)
34
- @file = make_file_logger(file_level, output_file)
35
- end
36
-
37
- %w(unknown fatal error warn info debug).each do |type|
38
- define_method(type) do |&block|
39
- @console.send(type, &block)
40
- @file&.send(type, &block)
41
- end
42
- end
43
-
44
- private
45
-
46
- def make_stdout_logger(level)
47
- ::Logger.new(STDOUT).tap do |logger|
48
- logger.formatter = STDOUT_FORMAT_PROC
49
- logger.level = level
50
- end
51
- end
52
-
53
- def make_file_logger(level, output_file)
54
- return unless output_file
55
- ::Logger.new(File.open(output_file, "a")).tap do |logger|
56
- logger.formatter = FILE_FORMAT_PROC
57
- logger.level = level
58
- end
59
- end
60
- end
61
- end
62
- end
1
+ module Ecoportal
2
+ module API
3
+ class Logger
4
+ TIMESTAMP_PATTERN = "%Y-%m-%dT%H:%M:%S"
5
+ STDOUT_FORMAT_PROC = proc do |severity, datetime, progname, msg|
6
+ prefix = "%5s > " % severity
7
+ msg.lines.map.with_index do |line, idx|
8
+ if idx.zero?
9
+ prefix + line.chomp
10
+ else
11
+ " "*prefix.length + line.chomp
12
+ end
13
+ end.join("\n")+"\n"
14
+ end
15
+ FILE_FORMAT_PROC = proc do |severity, datetime, progname, msg|
16
+ prefix = "%5s(%s) > " % [severity, datetime.strftime(TIMESTAMP_PATTERN)]
17
+ msg.lines.map.with_index do |line, idx|
18
+ if idx.zero?
19
+ prefix + line.chomp
20
+ else
21
+ " "*prefix.length + line.chomp
22
+ end
23
+ end.join("\n")+"\n"
24
+ end
25
+
26
+ attr_reader :console, :file
27
+
28
+ def initialize(
29
+ console_level: ::Logger::INFO,
30
+ file_level: ::Logger::DEBUG,
31
+ output_file: File.join(Dir.getwd, "API_Log-#{Time.now.strftime("%Y-%m-%dT%H%M")}.txt")
32
+ )
33
+ @console = make_stdout_logger(console_level)
34
+ @file = make_file_logger(file_level, output_file)
35
+ end
36
+
37
+ %w(unknown fatal error warn info debug).each do |type|
38
+ define_method(type) do |&block|
39
+ @console.send(type, &block)
40
+ @file&.send(type, &block)
41
+ end
42
+ end
43
+
44
+ private
45
+
46
+ def make_stdout_logger(level)
47
+ ::Logger.new(STDOUT).tap do |logger|
48
+ logger.formatter = STDOUT_FORMAT_PROC
49
+ logger.level = level
50
+ end
51
+ end
52
+
53
+ def make_file_logger(level, output_file)
54
+ return unless output_file
55
+ ::Logger.new(File.open(output_file, "a")).tap do |logger|
56
+ logger.formatter = FILE_FORMAT_PROC
57
+ logger.level = level
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end