bitodeme 0.1.6 → 0.1.7

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: fe2cb7024fd7c54372b86ab271e3fc6584989195
4
- data.tar.gz: add94ebfe050ddb35bd5bb44af551eb0a398f757
3
+ metadata.gz: 47c1bccb6089399d31440eab810a1b4c6ac210e0
4
+ data.tar.gz: '09d81264d360aa21da27fc71d5be93651365edbf'
5
5
  SHA512:
6
- metadata.gz: 921e682e47ab4f4221cb571c9328fdb66b054159f770c4a64f3dd887d097e284cf8ec61e4e51f4f3bbc4002ea45e554f2869433973652d5fefd72b13b16c5447
7
- data.tar.gz: 2a68db6a94c9149d974a080e2923ad8403d61f6ccabe5e29e519de5542b1e6a5471a1bf41d952c4bc420ca8d41d06cb10102ce3c3d98fbe7899b81bbdb01c6ad
6
+ metadata.gz: 6ad50422db90dac7723b63a2f9ae6d334a37388b3b86aee943c2e62a0443055bd13dded7e644727f5826dc1fe6b65bc1374fbeb7af426bef59b99d61977afdc8
7
+ data.tar.gz: 6bb4e53305ab0d79c98fd89d16ffc9f51b10fb1bd8b4767bcd691f7a1835c5454c178bfc07b9c59405a4509c3251f2e3ea20e123da4b616f0fb3c43b5bf67312
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bitodeme (0.1.5)
4
+ bitodeme (0.1.6)
5
5
  dotenv (~> 2.2, >= 2.2)
6
6
  faraday (~> 0.13)
7
7
  faraday_middleware (~> 0.12)
data/README.md CHANGED
@@ -131,6 +131,15 @@ withdrawal = Bitodeme.create_withdrawal(withdrawal)
131
131
 
132
132
  All plural methods support `pagination`(`per_page` and `page`) and `since` query parameters
133
133
 
134
+ ### Authentication
135
+
136
+ Bitodeme endpoint requests automatically authenticated by `bitodeme` library. But in case you need, you can fetch access token by running the command below. The token automatically renews itself, so you don't need to worry about token expiration. Note: Auth class instance is shared across the threads, so everytime you should get the same token until it expires.
137
+
138
+ ```ruby
139
+ auth = Bitodeme::Auth.build
140
+ auth.token
141
+ ```
142
+
134
143
  ## Standalone Usage
135
144
 
136
145
  In project root folder:
@@ -4,9 +4,10 @@ module Bitodeme
4
4
  # OAuth2 client credentials authenticator for Bitodeme
5
5
  class Auth
6
6
  extend Forwardable
7
+ include Singleton
7
8
 
8
- def initialize
9
- @expires_at = 0
9
+ def self.build
10
+ $bitodeme_auth ||= instance
10
11
  end
11
12
 
12
13
  # Valid access token for Bitodeme endpoints
@@ -17,7 +18,7 @@ module Bitodeme
17
18
 
18
19
  private
19
20
 
20
- USER_AGENT = "Ruby / Bitodeme v#{Bitodeme::VERSION}".freeze
21
+ USER_AGENT = "Ruby / Bitodeme::Auth v#{Bitodeme::VERSION}".freeze
21
22
  GRANT_TYPE = 'client_credentials'.freeze
22
23
  AUTH_ENDPOINT = '/api/v1/tokens'.freeze
23
24
 
@@ -26,6 +27,10 @@ module Bitodeme
26
27
 
27
28
  attr_reader :access_token, :expires_at
28
29
 
30
+ def initialize
31
+ @expires_at = 0
32
+ end
33
+
29
34
  def expired?
30
35
  Time.now.to_i > expires_at
31
36
  end
@@ -6,7 +6,7 @@ module Bitodeme
6
6
  class Conn
7
7
  include Singleton
8
8
 
9
- USER_AGENT = "Ruby / Bitodeme v#{Bitodeme::VERSION}".freeze
9
+ USER_AGENT = "Ruby / Bitodeme::Conn v#{Bitodeme::VERSION}".freeze
10
10
 
11
11
  def self.build
12
12
  $bitodeme_conn ||= instance.send(:conn)
@@ -17,7 +17,7 @@ module Bitodeme
17
17
  attr_reader :auth, :hostname
18
18
 
19
19
  def initialize
20
- @auth = Bitodeme::Auth.new
20
+ @auth = Bitodeme::Auth.build
21
21
  @hostname = Bitodeme.config.hostname
22
22
  end
23
23
 
@@ -1,3 +1,3 @@
1
1
  module Bitodeme
2
- VERSION = '0.1.6'.freeze
2
+ VERSION = '0.1.7'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bitodeme
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bitodeme Integrations Team