social_wallet 1.0.1 → 1.0.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: 980e18d6662ff45443f911f9d6fda9befc0b19f9
4
- data.tar.gz: 8da09fde43bdf70b49803ffd56e30c96ffae49ff
3
+ metadata.gz: fdf12140aa01114e5b4910a8985732936f945e91
4
+ data.tar.gz: 5133eca30991f157a9459c64452f2fb423dacaa9
5
5
  SHA512:
6
- metadata.gz: 8792a8c92a234d792854b9e5e0acf29aac5683a3a42bdc2e70e28453aa9c695aa272c4d97abb8acb8bf959af196992d51a47299d7de4c457fb234045d3cd3874
7
- data.tar.gz: 5daec7b6886713dc8043992c5793add7a1c059a91a9216725130804c2f8e4711a20c4ab6e39af9b6dac3f50f2706f07ade26bd85efd79fc01fe0a7f552ffdc53
6
+ metadata.gz: 3daad05172f5d38bc0fee1e398cf43178e25954b5654bb66123271da5c03d7c0bc8743b84ff1542dba75958eb3cb5be23f9fb9887d310c26090a8a4e4e9620c8
7
+ data.tar.gz: 227fa5b9ea0637535d215297ff68eb6d7a8c951d09f1a082fdd4893734ab2e61966bd2179016429eae45a21259e4c342fe18a031183f030e280b24d9929d5cae
data/README.md CHANGED
@@ -62,13 +62,39 @@ client.transactions.new(from_id: 'paolo', to_id: 'aaron', amount: 10, tags: ['ta
62
62
  Retrieve the list of the transactions of a specific account.
63
63
 
64
64
  ```ruby
65
- client.transactions(account_id: 'pietro').list
65
+ client.transactions(account_id: 'pietro', count: 0, from: 0, page: 0, per_page: 0, currency: 'MONGO').list
66
66
  ```
67
67
 
68
- Retrieve the list of the transactions of the default account.
68
+ To retrieve the list of the transactions of the default account use `account_id: ''`
69
+
70
+ ##### Optional parameters
71
+
72
+ * **Paginated results**: for *database* transactions use `:page` and `:per_page` (defaults: `page: 1`, `per_page: 10`. Use `0` for ALL), for *blockchain* transactions use `:count` and `:from`.
73
+
74
+ * **Filter by currency**: another optional parameter for *database* transactions is `:currency`, to filter transactions only by one currency.
75
+
76
+ **Response**
77
+
78
+ The list of transaction is always paginated to avoid overload on the server.
69
79
 
70
80
  ```ruby
71
- client.transactions(account_id: '').list
81
+ {
82
+ 'total-count'=>42,
83
+ 'transactions'=>[
84
+ {
85
+ 'tags'=>['tag1', 'tag2'],
86
+ 'timestamp'=>'2018-02-23T20:10:01.331',
87
+ 'from-id'=>'pietro',
88
+ 'to-id'=>'aaron',
89
+ 'amount'=>10,
90
+ 'amount-text'=>'10.0',
91
+ 'transaction-id'=>'xqc4cvhr...pCPfju5inCO',
92
+ 'currency'=>'MONGO'
93
+ },
94
+ {
95
+ ...
96
+ }]
97
+ }
72
98
  ```
73
99
 
74
100
  **IMPORTANT**: the format of the response varies according to the backend used (e.g. `faircoin` or `mongo`). See the [Get](#transactions-get) for details.
@@ -25,8 +25,20 @@ module SocialWallet
25
25
 
26
26
  protected
27
27
 
28
- def ___transactions(account_id: nil)
28
+ def ___transactions(
29
+ account_id: nil,
30
+ count: nil,
31
+ from: nil,
32
+ page: nil,
33
+ per_page: nil,
34
+ currency: nil
35
+ )
29
36
  @account_id = account_id
37
+ @count = count
38
+ @from = from
39
+ @page = page
40
+ @per_page = per_page
41
+ @currency = currency
30
42
  self
31
43
  end
32
44
 
@@ -135,7 +147,14 @@ module SocialWallet
135
147
  conn = Faraday.new(url: api_endpoint + '/' + path, ssl: { version: 'TLSv1_2' })
136
148
  response = conn.post do |req|
137
149
  req.headers['Content-Type'] = 'application/json'
138
- request_data['account-id'] = @account_id if @path_parts.include?('transactions')
150
+ if @path_parts.include?('transactions')
151
+ request_data['account-id'] = @account_id
152
+ request_data['count'] = @count unless @count.nil?
153
+ request_data['from'] = @from unless @from.nil?
154
+ request_data['page'] = @page unless @page.nil?
155
+ request_data['per-page'] = @per_page unless @per_page.nil?
156
+ request_data['currency'] = @currency unless @currency.nil?
157
+ end
139
158
  req.body = MultiJson.dump(request_data)
140
159
  end
141
160
  format_response(response)
@@ -1,3 +1,3 @@
1
1
  module SocialWallet
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: social_wallet
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - pbmolini
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-05-15 00:00:00.000000000 Z
11
+ date: 2018-12-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday