ac 0.2.1 → 0.2.2
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/lib/ac/base.rb +13 -5
- data/lib/ac/version.rb +1 -1
- metadata +3 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 643c497232d37751e8f24f1e429e4da6de134fe5fb8c9ee7a553a72e96afc511
|
4
|
+
data.tar.gz: 887dab256a947fb6ec90be7e63814832d4b868f6873ff13d64944969391d4d51
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bda3634f53042d6d31d4cae8191b0f31f87fbd00553cb67b60e0fd806e02487b8ff26ff85d5860050c0af66b6738d55864acfa1dd0c94881eb56b2fc8f106255
|
7
|
+
data.tar.gz: 956b86c314638bc2d577716622c25c1dbebc8741603c6e3c029e21d989f93a0439ae68cba1d307997a46f89337276f9f691254d84d2dfd8c54e96b2aac1f9253
|
data/lib/ac/base.rb
CHANGED
@@ -9,16 +9,24 @@ module Ac
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def url path
|
12
|
-
|
12
|
+
if path.start_with?("http://") || path.start_with?("https://")
|
13
|
+
path
|
14
|
+
else
|
15
|
+
File.join(self.class::BASE_URL, path)
|
16
|
+
end
|
13
17
|
end
|
14
18
|
|
19
|
+
def authenticate! options
|
20
|
+
if access_token
|
21
|
+
options[:headers] ||= {}
|
22
|
+
options[:headers]["Authorization"] = "Bearer #{access_token}"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
15
26
|
%i[get post put patch delete].each do |http_verb|
|
16
27
|
define_method :"#{http_verb}_request" do |path, options = {}|
|
17
28
|
options[:method] = http_verb
|
18
|
-
|
19
|
-
options[:headers] ||= {}
|
20
|
-
options[:headers]["Authorization"] = "Bearer #{access_token}"
|
21
|
-
end
|
29
|
+
authenticate!(options) unless options.delete(:skip_authentication)
|
22
30
|
Typhoeus::Request.new url(path), options
|
23
31
|
end
|
24
32
|
|
data/lib/ac/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ac
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- felipedmesquita
|
8
|
-
autorequire:
|
9
8
|
bindir: exe
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-03-06 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: typhoeus
|
@@ -24,7 +23,6 @@ dependencies:
|
|
24
23
|
- - ">="
|
25
24
|
- !ruby/object:Gem::Version
|
26
25
|
version: '0'
|
27
|
-
description:
|
28
26
|
email:
|
29
27
|
- 16197684+felipedmesquita@users.noreply.github.com
|
30
28
|
executables: []
|
@@ -46,7 +44,6 @@ licenses:
|
|
46
44
|
metadata:
|
47
45
|
homepage_uri: https://github.com/felipedmesquita/ac
|
48
46
|
source_code_uri: https://github.com/felipedmesquita/ac
|
49
|
-
post_install_message:
|
50
47
|
rdoc_options: []
|
51
48
|
require_paths:
|
52
49
|
- lib
|
@@ -61,8 +58,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
61
58
|
- !ruby/object:Gem::Version
|
62
59
|
version: '0'
|
63
60
|
requirements: []
|
64
|
-
rubygems_version: 3.
|
65
|
-
signing_key:
|
61
|
+
rubygems_version: 3.6.2
|
66
62
|
specification_version: 4
|
67
63
|
summary: Api Client for Typhoeus
|
68
64
|
test_files: []
|