eac_rest 0.10.0 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0fe5757eaf77cd67597c26aa58e150392aa661781cd19123f835aa503dad12fc
4
- data.tar.gz: 9982b978e4718a87847522ef9b140a159f36d29379efe85e5c2d7be5c5bd34ca
3
+ metadata.gz: c6ea54f4879bd8986f51bb61675479e688510922dec567816955d9fdc82120e1
4
+ data.tar.gz: 4a3c2f7ede1e8ffa3031a731ff1bc66d9521c9d8c93c997d3e00597e4016dffa
5
5
  SHA512:
6
- metadata.gz: 37fc4fd969a082152524de5313b08b9ae9f246b86725da8635365e9487cb6dde875b1aeff87852dd1016d2017b6edc59fadc7b8c4f221a399017be04f43f818b
7
- data.tar.gz: 3486088ae1c66584166bae20afe57641eb7f1d4fe5ad27a5441989bc10dd0fd04c439a4effed9f6859b88c9eeced958988c05c8385bdd73e72be706c297b4052
6
+ metadata.gz: 852082a762e5ad0df28b520636be72c521376828793d24fe3f442bc309d637195633220f262bdbdd5a0f8273a8f643949caabe40f87b352407ac56f79e7080a8
7
+ data.tar.gz: 4b9b1ffb18491caf4d4615ac4d29bdb9ab3f4c785a6968ce8ee19ea66ced56cb6acfaaf2163073e887cfa98dc2edab80e7412a6b394295fcd6fffb2b01a9106e
data/lib/eac_rest/api.rb CHANGED
@@ -9,9 +9,11 @@ module EacRest
9
9
  # * self.issue_get_url_suffix(provider_issue_id)
10
10
  class Api
11
11
  DEFAULT_ROOT_ENTITY_CLASS_NAME_SUFFIX = 'Root'
12
+ JSON_REQUEST_HEADERS = { 'Accept' => 'application/json' }.freeze
12
13
 
13
14
  require_sub __FILE__, include_modules: true
14
15
  attr_accessor :ssl_verify
16
+
15
17
  common_constructor :root_url, :username, :password, default: [nil, nil] do
16
18
  self.ssl_verify = true
17
19
  end
@@ -32,7 +34,7 @@ module EacRest
32
34
  end
33
35
 
34
36
  def request_json(service_url_suffix, headers = {}, &body_data_proc)
35
- request(service_url_suffix, headers.merge('Accept' => 'application/json')) do |body_data|
37
+ request(service_url_suffix, headers.merge(JSON_REQUEST_HEADERS)) do |body_data|
36
38
  r = body_data.is_a?(::Enumerable) ? body_data : ::JSON.parse(body_data)
37
39
  r = body_data_proc.call(r) if body_data_proc
38
40
  r
@@ -6,6 +6,7 @@ require 'eac_ruby_utils/core_ext'
6
6
 
7
7
  module EacRest
8
8
  class Request
9
+ BODY_DATA_JSON_HEADERS = { 'Content-Type' => 'application/json' }.freeze
9
10
  attr_reader :internal_request
10
11
 
11
12
  # @param url [EacEnvs::Http::Request, String]
@@ -40,6 +41,12 @@ module EacRest
40
41
  self.class.new(internal_request.basic_auth(username, password))
41
42
  end
42
43
 
44
+ # @param object [Object]
45
+ # @param self
46
+ def body_data_json(object)
47
+ body_data(object.to_json).headers(headers.merge(BODY_DATA_JSON_HEADERS))
48
+ end
49
+
43
50
  # @return [EacRest::Response]
44
51
  def response
45
52
  ::EacRest::Response.new(self)
@@ -14,7 +14,7 @@ module EacRest
14
14
  end
15
15
 
16
16
  %i[body_data body_data_or_raise body_str body_str_or_raise header headers
17
- link links raise_unless_200 status to_s url].each do |method_name|
17
+ link links raise_unless_200 status to_s url].each do |method_name| # rubocop:disable Naming/VariableNumber
18
18
  define_method method_name do |*args, &block|
19
19
  internal_response.send(method_name, *args, &block)
20
20
  rescue ::EacEnvs::Http::Error
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRest
4
- VERSION = '0.10.0'
4
+ VERSION = '0.11.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eac_rest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eduardo H. Bogoni
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-08 00:00:00.000000000 Z
11
+ date: 2023-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: eac_envs-http
@@ -50,48 +50,28 @@ dependencies:
50
50
  requirements:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: '0.119'
54
- - - ">="
55
- - !ruby/object:Gem::Version
56
- version: 0.119.1
53
+ version: '0.120'
57
54
  type: :runtime
58
55
  prerelease: false
59
56
  version_requirements: !ruby/object:Gem::Requirement
60
57
  requirements:
61
58
  - - "~>"
62
59
  - !ruby/object:Gem::Version
63
- version: '0.119'
64
- - - ">="
65
- - !ruby/object:Gem::Version
66
- version: 0.119.1
67
- - !ruby/object:Gem::Dependency
68
- name: aranha-parsers
69
- requirement: !ruby/object:Gem::Requirement
70
- requirements:
71
- - - "~>"
72
- - !ruby/object:Gem::Version
73
- version: '0.15'
74
- type: :development
75
- prerelease: false
76
- version_requirements: !ruby/object:Gem::Requirement
77
- requirements:
78
- - - "~>"
79
- - !ruby/object:Gem::Version
80
- version: '0.15'
60
+ version: '0.120'
81
61
  - !ruby/object:Gem::Dependency
82
62
  name: eac_ruby_gem_support
83
63
  requirement: !ruby/object:Gem::Requirement
84
64
  requirements:
85
65
  - - "~>"
86
66
  - !ruby/object:Gem::Version
87
- version: 0.5.1
67
+ version: '0.9'
88
68
  type: :development
89
69
  prerelease: false
90
70
  version_requirements: !ruby/object:Gem::Requirement
91
71
  requirements:
92
72
  - - "~>"
93
73
  - !ruby/object:Gem::Version
94
- version: 0.5.1
74
+ version: '0.9'
95
75
  description:
96
76
  email:
97
77
  executables: []
@@ -119,7 +99,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
119
99
  requirements:
120
100
  - - ">="
121
101
  - !ruby/object:Gem::Version
122
- version: '0'
102
+ version: '2.7'
123
103
  required_rubygems_version: !ruby/object:Gem::Requirement
124
104
  requirements:
125
105
  - - ">="