social_wallet 1.1.0 → 1.2.0

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: efcf1377f95d5c41b20f36ecd8944a19c3429f08
4
- data.tar.gz: 897540772baadda63332f1c9ee802c40fdab005f
3
+ metadata.gz: f4a455067fda9d8fee196062f7702871c045a672
4
+ data.tar.gz: 331643bfd1ce3a654a66bd79ae4b0f1c5433f017
5
5
  SHA512:
6
- metadata.gz: c3e7b14d90113b7f0ada0edebf16cb24a78cfb562eae0eed59d0ec391bf7350ece2c70a6d37484a4bec0628d9e345461e8aea61ef1c4d97247f070aae8f974fe
7
- data.tar.gz: 6c73550c70671e4b4efb7fa2a33cc72bfe1418e08c92e3b26c6522cbe2b1e2c5a792c2aa4019368d7d71ee0da24c628450ed5fbd2e5d2be5d9dbad2acd8e9693
6
+ metadata.gz: 5e0546c69bbf6f17b6df361b6e3fd628981466b9ff9e675f9840b22a51ecdcdcbf53a29016c2b7add54acfa69bc6d9ef32b28e0a00fecfe541e9ee9743d288a8
7
+ data.tar.gz: ae5b13893e916dd280c32a5d690367ed95d674ac5f212629c9cee14c7346db6609f5b861039dda9e1fd89ffb933e3d012fa827061f5ff5b3bf48f9925602fd91
data/README.md CHANGED
@@ -22,21 +22,27 @@ Or install it yourself as:
22
22
 
23
23
  ### ⚠️ Version compatibility ⚠️
24
24
 
25
+ If you use [Social Wallet API](https://github.com/Commonfare-net/social-wallet-api) version 1.0 you must use [v1.1.0 of this gem](https://github.com/Commonfare-net/social_wallet_ruby/tree/d65c45e0aaca07cdf3a3affc483bb38d3dbef1c0).
26
+
25
27
  If you use [Social Wallet API](https://github.com/Commonfare-net/social-wallet-api) version ≤ 0.10.x you must use [v1.0.3 of this gem](https://github.com/Commonfare-net/social_wallet_ruby/tree/5fe6ee36f3055de165540f49eb03e54ea9fc268d).
26
28
 
29
+ ### Get the API KEY
30
+
31
+ See [this guide](https://github.com/Commonfare-net/social-wallet-api/blob/master/APIKEY.md) for obtaining your API key.
32
+
27
33
  ### Create the client
28
34
 
29
35
  The default client uses the *database* `mongo` as backend.
30
36
 
31
37
  ```ruby
32
- client = SocialWallet::Client.new(api_endpoint: 'http://example.com/wallet/v1')
38
+ client = SocialWallet::Client.new(api_endpoint: 'http://example.com/wallet/v1', api_key: 'YOUR_API_KEY')
33
39
  ```
34
40
 
35
41
  This constructor defaults to a client that uses `connection: 'mongo'` and `type: 'db-only'`.
36
42
  If you want to use the API on a different backend just specify it like this:
37
43
 
38
44
  ```ruby
39
- client = SocialWallet::Client.new(api_endpoint: 'http://example.com/wallet/v1', connection: 'faircoin', type: 'blockchain-and-db')
45
+ client = SocialWallet::Client.new(api_endpoint: 'http://example.com/wallet/v1', api_key: 'YOUR_API_KEY', connection: 'faircoin', type: 'blockchain-and-db')
40
46
  ```
41
47
 
42
48
  ### List of tags
@@ -1,16 +1,18 @@
1
1
  module SocialWallet
2
2
  class Client
3
- attr_accessor :api_endpoint, :blockchain, :request_data, :connection, :type
3
+ attr_accessor :api_endpoint, :api_key, :blockchain, :request_data, :connection, :type
4
4
 
5
5
  SW_ERROR_STATUSES = [404, 503].freeze
6
6
 
7
7
  def initialize(
8
8
  api_endpoint: nil,
9
+ api_key: '',
9
10
  blockchain: 'mongo',
10
11
  connection: 'mongo',
11
12
  type: 'db-only'
12
13
  )
13
14
  @api_endpoint = api_endpoint
15
+ @api_key = api_key
14
16
  @blockchain = blockchain # NOTE: here for backward compatibility
15
17
  @connection = connection
16
18
  @type = type
@@ -232,7 +234,7 @@ module SocialWallet
232
234
  def headers
233
235
  {
234
236
  'Content-Type' => 'application/json',
235
- # 'x-api-key' => ENV['SOCIAL_WALLET_API_KEY']
237
+ 'x-api-key' => api_key
236
238
  }
237
239
  end
238
240
  end
@@ -1,3 +1,3 @@
1
1
  module SocialWallet
2
- VERSION = "1.1.0"
2
+ VERSION = "1.2.0"
3
3
  end
data/test_env.yml.example CHANGED
@@ -1,4 +1,4 @@
1
1
  # Before running tests, copy this file to `test_env.yml`
2
2
  # and fill that file with the appropriate values
3
3
  TEST_API_ENDPOINT: http://example.com/wallet/v1
4
- TEST_API_KEY: your_api_key # not used in this release
4
+ TEST_API_KEY: your_api_key
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: social_wallet
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - pbmolini