api_signature 0.1.2 → 0.1.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: da355026c9f2496d70247070daaabf9ad9c2de63
4
- data.tar.gz: 122376c16db803019a9d659ab6ec50538c7e0416
3
+ metadata.gz: 8b90e636522e32ca312ed9f8c95cad9347808959
4
+ data.tar.gz: 01fd8263b4537b61d5b01d2c573f86eaaf1bf5d8
5
5
  SHA512:
6
- metadata.gz: ad13847a2ebf181a06157f68ee61f439f6f3fb8307f2b7a193344c901fec9b32148711ba6a16524b79ca2adcf4e4db812771a5cecb40cb89ca3e61a1ddf49626
7
- data.tar.gz: 823f389cb467893a2d6887cebc57cee1c5dc1d8c0d1cc11506c63c23fe09bf870bf302fec21d81a29fbfe629087c99c54ac3e176ec670dcf087a3504b3596fa7
6
+ metadata.gz: a7a6afd0e8da50f2e211a2816201ab310cc35c571bd98e714983f76e3a6ca13cbab8bf81a59f8462a9ee8082c851e7e703c85e0332d2bc2cb32b0711b19fdece
7
+ data.tar.gz: c741365bdbcb8acf8fdd77783d1aeb34d14a1fdcf4ad0ff0737bd78258cee704ddd02958e00cead57de7ce4cd43fb658026feadd5e58c80716310cc6343934a3
data/README.md CHANGED
@@ -100,7 +100,7 @@ options = {
100
100
  timestamp: Time.zone.now.to_i
101
101
  }
102
102
 
103
- signature = ApiSignature::Generator.new(options).generate_signatute('api_secret')
103
+ signature = ApiSignature::Generator.new(options).generate_signature('api_secret')
104
104
  ```
105
105
 
106
106
  By default, the generated signature will be valid for 2 hours
@@ -6,7 +6,7 @@ require 'ostruct'
6
6
  module ApiSignature
7
7
  class Builder
8
8
  OPTIONS_KEYS = [
9
- :access_key, :secret, :request_method, :scheme, :host, :port, :path, :params, :timestamp
9
+ :access_key, :secret, :request_method, :path, :timestamp
10
10
  ].freeze
11
11
 
12
12
  delegate(*OPTIONS_KEYS, to: :@settings)
@@ -29,10 +29,6 @@ module ApiSignature
29
29
  }
30
30
  end
31
31
 
32
- def string_headers
33
- headers.map { |key, value| "#{key}:#{value}" }.join(' ')
34
- end
35
-
36
32
  def options
37
33
  {
38
34
  timestamp: timestamp,
@@ -46,11 +42,6 @@ module ApiSignature
46
42
  @signature ||= signature_generator.generate_signature(secret)
47
43
  end
48
44
 
49
- def url
50
- klass = scheme.try(:downcase) == 'https' ? URI::HTTPS : URI::HTTP
51
- klass.build(host: host, port: port, path: options[:path])
52
- end
53
-
54
45
  private
55
46
 
56
47
  def signature_generator
@@ -35,8 +35,9 @@ module ApiSignature
35
35
  def with_signature(http_method, api_key, secret, action_name, params = {})
36
36
  path = PathBuilder.new(controller, action_name, params).path
37
37
  headers = HeadersBuilder.new(api_key, secret, http_method, path).headers
38
+ custom_headers = params.delete(:headers) || {}
38
39
 
39
- send(http_method, path, params, headers)
40
+ send(http_method, path, params, headers.merge(custom_headers))
40
41
  end
41
42
  end
42
43
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ApiSignature
4
- VERSION = '0.1.2'
4
+ VERSION = '0.1.3'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: api_signature
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Galeta
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2018-07-31 00:00:00.000000000 Z
12
+ date: 2018-09-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler