soaspec 0.1.10 → 0.1.11

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
  SHA1:
3
- metadata.gz: 9d48c8b910dd2bf87abcae57a3a7ef25f9bdd59d
4
- data.tar.gz: 4c0d3566be81b05fa06878f7a01d0b54ccf776ca
3
+ metadata.gz: 2f8a71ef7aaaed332941f635ea0c8dae5635b2c7
4
+ data.tar.gz: ace048d3a5dbd883c0523c6f2a5f654e51b486b6
5
5
  SHA512:
6
- metadata.gz: ee025f3a394441a6ee3612befcaf94f36c3a0d3d5dc2901230f300f4d0798424f08315e6c82009b574d0ab98dce77f432579d265e445bf4ec15c8220f5b05824
7
- data.tar.gz: 50abba523c74d01f098a9bd1e9b061ea9e6fbe66735c59cf5110e13174c5cb166537f1d0361c1fae9377f1889f2e2c6b048d81e358e3a6aac0f108c4b9644ab7
6
+ metadata.gz: 13201679a589ce4856d1f9e61df09d25e8ec72242a1f4d2e8e781654e72c961c8a653555a6c3c7c9197e51b7d2643348ea0f5049115b2255b2546890db15a1b8
7
+ data.tar.gz: 52962a53cb57f808154936718de1aab8a0a30b2488e5cf2bf302e9f6c62caf8b58590c1be4832089221fcd60fd385f0bf9b490cd018a53315b9a1d2f5445d848
data/ChangeLog CHANGED
@@ -1,9 +1,14 @@
1
+ Version 0.1.11
2
+ * Enhancements
3
+ * OAuth2 class can be initialized with strings as keys
4
+ * Global attribute, 'Soaspec::OAuth2.token_url' for setting common value
5
+
1
6
  Version 0.1.10
2
7
  * Enhancements
3
8
  * Rename default template folder from to 'template' to 'templates'
4
9
  * Use TemplateReader to simplify and add error handling to extracting templates
5
10
  * Got convenience Rest Methods able to handle taking in template_name
6
- * Started making a request method to access request of API actually sent
11
+ * Started making a 'request' method to access request of API actually sent
7
12
 
8
13
  Version 0.1.9
9
14
  * Enhancements
@@ -34,8 +34,7 @@ module Soaspec
34
34
  full_path += '.yml' unless full_path.end_with?('.yml')
35
35
  file_hash = YAML.load_file(full_path)
36
36
  raise 'File at ' + full_path + ' is not a hash ' unless file_hash.is_a? Hash
37
- oauth_hash = file_hash.transform_keys_to_symbols
38
- oauth2 **oauth_hash
37
+ oauth2 file_hash
39
38
  end
40
39
 
41
40
  # @param [Hash] headers Hash of REST headers used in RestClient
@@ -3,15 +3,23 @@ require 'erb'
3
3
  module Soaspec
4
4
  # Handles working with OAuth2
5
5
  class OAuth2
6
+ class << self
7
+ # Default token url used across entire suite
8
+ attr_accessor :token_url
9
+ end
10
+
11
+ # [Hash] OAuth parameters
6
12
  attr_accessor :params
7
13
  # Count of tries to obtain access token
8
14
  attr_accessor :retry_count
9
15
 
10
- # @param [Hash] params Parameters to make OAuth request
16
+ # @param [Hash] params_sent Parameters to make OAuth request
11
17
  # @param [String] api_username Username to use which can be set by Soaspec::ExchangeHandler
12
- def initialize(params, api_username)
18
+ def initialize(params_sent, api_username = nil)
19
+ params = params_sent.transform_keys_to_symbols
20
+ params[:token_url] ||= Soaspec::OAuth2.token_url
13
21
  raise 'client_id and client_secret not set' unless params[:client_id] && params[:client_secret]
14
- raise 'token_url mandatory' unless params[:token_url]
22
+ raise ArgumentError, 'token_url mandatory' unless params[:token_url]
15
23
  self.params = params
16
24
  params[:username] = api_username || ERB.new(params[:username]).result(binding) if params[:username]
17
25
  params[:security_token] = ERB.new(params[:security_token]).result(binding) if params[:security_token]
@@ -62,6 +70,5 @@ module Soaspec
62
70
  { grant_type: 'client_credentials' }
63
71
  end)
64
72
  end
65
-
66
73
  end
67
74
  end
@@ -1,3 +1,3 @@
1
1
  module Soaspec
2
- VERSION = '0.1.10'.freeze
2
+ VERSION = '0.1.11'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: soaspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - SamuelGarrattIQA
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-10-09 00:00:00.000000000 Z
11
+ date: 2018-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler