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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ac/base.rb +13 -5
  3. data/lib/ac/version.rb +1 -1
  4. metadata +3 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 170cf1e02401172b4227c6962753133678a1abe747e4a1dea5e2bd7ab0ba9a68
4
- data.tar.gz: f87fabaf5c3a60282271f448fd206e62aeb1f5b2a34d7dcbe0fbceacf61f0e5e
3
+ metadata.gz: 643c497232d37751e8f24f1e429e4da6de134fe5fb8c9ee7a553a72e96afc511
4
+ data.tar.gz: 887dab256a947fb6ec90be7e63814832d4b868f6873ff13d64944969391d4d51
5
5
  SHA512:
6
- metadata.gz: 7bedbce4e164703ad7f5fd73c285858d8f9da4f2ce08963cd694ef224fb6b3ea4fdb4ec88b9fc18e1ffb5675a80adc6cbfa10776e3cf4010dbbc0b7ce0dd69fe
7
- data.tar.gz: 52368ebfdf4291c7d07abac7fe04eae2d15fff5a4789c3cb585c0fa50ac36b33aa9bfe844bfac72f4809d626944045b5f5bedb1bce903707a9ef3ac2d1c3dabd
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
- File.join(self.class::BASE_URL, path)
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
- if access_token
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ac
4
- VERSION = "0.2.1"
4
+ VERSION = "0.2.2"
5
5
  end
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.1
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: 2024-12-13 00:00:00.000000000 Z
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.4.10
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: []