feature_flag_client 0.3.0 → 0.3.1

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
  SHA256:
3
- metadata.gz: 7065c7ae5de763c0b60757abd3acd69d954cfbcd061fc7111dc1eaa2528b07a7
4
- data.tar.gz: 4bbf3c3ea64cfe1e0d930b7c8354b5e1d9d7d9bb14ac79f6d64976c7554e38d1
3
+ metadata.gz: 480ade652127284ad973576700e2dfbe5e423a05081e9cf3ab877b1cf6c578f2
4
+ data.tar.gz: efb33fededa07a587bbe3a7e70dadba38b541041ae3b114da44a648a7a06bc30
5
5
  SHA512:
6
- metadata.gz: 4f46c05adc2f1ab77e7346bdaafe93dcb9a45c24cd02776c8eba35271eb39aa2d60a0bf38ad98c813ff611c50d4a79c49881fe339145968959fcfc0d3cecbd31
7
- data.tar.gz: bb6dca6a4596fd467c59738befcf6966cdc5b7665e0caee51139bf6dbe29197c7931aa3e8c3306ab9dda6c4bbc480cecd18d9bdbc3799f3682464c616d352fcc
6
+ metadata.gz: 781a171abd90e22feab8562d3cfe8f44262edb2afe95b43f1e6acf0f04bfa5d814e8afa56e095bdb4f0afc633433e13340fe0d6b028feea1ff8c0f96cff359d5
7
+ data.tar.gz: 2c8284e85c15166f5d13bae42d0617ed86f19c78c1016c2e111e42fe3bba814d26c2ccce401988b5c9e8b1b3b0227a12712d3d4eaf07f5c69943863c1d3f284c
@@ -1,3 +1,7 @@
1
+ ## 0.3.1
2
+
3
+ * Introduce error handling on `FeatureFlagClient::Session`
4
+
1
5
  ## 0.3.0
2
6
 
3
7
  * Fix the wrong documentation on configuration in README
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
13
13
 
14
14
  spec.summary = 'Write a short summary, because RubyGems requires one.'
15
15
  spec.description = 'Write a longer description or delete this line.'
16
- spec.homepage = 'https://github.com/ardeshireshghi/feature-flag-clients/tree/master/lib/clients/ruby/feature-flag-client'
16
+ spec.homepage = 'https://github.com/ardeshireshghi/feature-flag-clients/tree/master/clients/ruby/feature-flag-client'
17
17
  spec.license = 'MIT'
18
18
 
19
19
  # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
@@ -2,6 +2,6 @@
2
2
 
3
3
  module FeatureFlagClient
4
4
  module Version
5
- VERSION = '0.3.0'
5
+ VERSION = '0.3.1'
6
6
  end
7
7
  end
@@ -1,15 +1,22 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'httparty'
4
+ require 'logger'
4
5
 
5
6
  module FeatureFlagClient
6
7
  # Takes care of getting access_token necessary to call features service
8
+ class SessionError < StandardError; end
9
+
7
10
  class Session
8
11
  attr_accessor :client_id, :client_secret, :auth_service_url
12
+ attr_reader :logger
9
13
 
10
14
  def initialize(client_id:, client_secret:)
11
15
  @client_id = client_id
12
16
  @client_secret = client_secret
17
+ @logger = Logger.new(STDOUT)
18
+ @logger.level = Logger::WARN
19
+
13
20
  yield(self) if block_given?
14
21
  end
15
22
 
@@ -36,7 +43,16 @@ module FeatureFlagClient
36
43
  }
37
44
  })
38
45
 
46
+
39
47
  @parsed_auth_response = JSON.parse(auth_service_response_raw.body)
48
+
49
+ if auth_service_response_raw.code >= 400
50
+ logger.error('Error requesting access token from feature flag auth')
51
+ logger.error(@parsed_auth_response)
52
+
53
+ raise SessionError
54
+ end
55
+
40
56
  @parsed_auth_response['access_token']
41
57
  end
42
58
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: feature_flag_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ardeshir Eshghi
@@ -119,12 +119,12 @@ files:
119
119
  - lib/feature_flag_client/client.rb
120
120
  - lib/feature_flag_client/client/version.rb
121
121
  - lib/feature_flag_client/session.rb
122
- homepage: https://github.com/ardeshireshghi/feature-flag-clients/tree/master/lib/clients/ruby/feature-flag-client
122
+ homepage: https://github.com/ardeshireshghi/feature-flag-clients/tree/master/clients/ruby/feature-flag-client
123
123
  licenses:
124
124
  - MIT
125
125
  metadata:
126
126
  allowed_push_host: https://rubygems.org
127
- homepage_uri: https://github.com/ardeshireshghi/feature-flag-clients/tree/master/lib/clients/ruby/feature-flag-client
127
+ homepage_uri: https://github.com/ardeshireshghi/feature-flag-clients/tree/master/clients/ruby/feature-flag-client
128
128
  source_code_uri: https://github.com/ardeshireshghi/feature-flag-clients/lib/clients/ruby
129
129
  changelog_uri: https://github.com/ardeshireshghi/feature-flag-clients/lib/clients/ruby/feature-flag-client/CHANGELOG.md
130
130
  post_install_message: