promisepay 1.1.0 → 1.2.0

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: 174ed6f8678e430701da0c172bfc2bc1fc48d93e
4
- data.tar.gz: e7cf1118146b2dbcf34157b299258b7522ffe75f
3
+ metadata.gz: 57f43019a6f05aa2f50da36cb20c065797bc29ac
4
+ data.tar.gz: c01e913c244fba6c5b9b47593848430e71c9e6a6
5
5
  SHA512:
6
- metadata.gz: 59c33e45e95b0d7c718631f3f44f2ad83c32b5d421a6cb9f26eefe29d989cf5bb8bc496a4f56dc8b944cdb59f9efbd61c24a14cab6634a11c0f0640f2d63907e
7
- data.tar.gz: 00135493b031cff9e61de1c06acad38cc82edc6bf48c187c5deebe8ccc1fb40a0c4936fd567fc637bc55d9951edefd5b0c966fb241cb35de2bc391c28c153383
6
+ metadata.gz: b10a14ec65401cf4456e1c3e337c43c99779e4aac6427388920356bd8081cfbca9cd656ee86e50a46d5ab713bc534a5ebf96de940b5130c7d6976d16bfc6e900
7
+ data.tar.gz: b733b1ab53246bb06db75fbbde3032f02e46740ec3e38309c769393610e9b9971c6a635d305fd8f99920d66d513916b13fe480055cf89da865109f59d55ca026
data/README.md CHANGED
@@ -153,7 +153,11 @@ item.fees
153
153
  ```
154
154
  #####Get an item's transactions
155
155
  ```ruby
156
- item.transaction
156
+ item.transactions
157
+ ```
158
+ #####Get an item's batch transactions
159
+ ```ruby
160
+ item.batch_transactions
157
161
  ```
158
162
  #####Get an item's wire details
159
163
  ```ruby
@@ -498,6 +502,16 @@ transaction.users
498
502
  transaction.fees
499
503
  ```
500
504
 
505
+ ##Batch Transactions
506
+ #####Get a list of batch transactions
507
+ ```ruby
508
+ batch_transactions = client.batch_transactions.find_all
509
+ ```
510
+ #####Get a transaction
511
+ ```ruby
512
+ batch_transaction = client.batch_transactions.find('1')
513
+ ```
514
+
501
515
  ##Charges
502
516
  #####Get a list of charges
503
517
  ```ruby
@@ -3,6 +3,7 @@ require_relative 'error'
3
3
  require_relative 'models/base_model'
4
4
  require_relative 'models/account'
5
5
  require_relative 'models/bank_account'
6
+ require_relative 'models/batch_transaction'
6
7
  require_relative 'models/card_account'
7
8
  require_relative 'models/charge'
8
9
  require_relative 'models/company'
@@ -16,6 +17,7 @@ require_relative 'models/wallet_account'
16
17
  require_relative 'resources/base_resource'
17
18
  require_relative 'resources/account_resource'
18
19
  require_relative 'resources/bank_account_resource'
20
+ require_relative 'resources/batch_transaction_resource'
19
21
  require_relative 'resources/card_account_resource'
20
22
  require_relative 'resources/charge_resource'
21
23
  require_relative 'resources/company_resource'
@@ -128,6 +130,7 @@ module Promisepay
128
130
  def self.resources
129
131
  {
130
132
  bank_accounts: BankAccountResource,
133
+ batch_transactions: BatchTransactionResource,
131
134
  card_accounts: CardAccountResource,
132
135
  charges: ChargeResource,
133
136
  companies: CompanyResource,
@@ -0,0 +1,5 @@
1
+ module Promisepay
2
+ # Manage Batch Transacations
3
+ class BatchTransaction < BaseModel
4
+ end
5
+ end
@@ -59,7 +59,7 @@ module Promisepay
59
59
  fees.map { |attributes| Promisepay::Fee.new(@client, attributes) }
60
60
  end
61
61
 
62
- # Get historical transaction for the item.
62
+ # Get historical transactions for the item.
63
63
  #
64
64
  # @see https://reference.promisepay.com/#list-item-transactions
65
65
  #
@@ -74,6 +74,21 @@ module Promisepay
74
74
  transactions.map { |attributes| Promisepay::Transaction.new(@client, attributes) }
75
75
  end
76
76
 
77
+ # Get historical batch_transactions for the item.
78
+ #
79
+ # @see https://reference.promisepay.com/#list-item-batch-transactions
80
+ #
81
+ # @param options [Hash] Optional options.
82
+ # @option options [Integer] :limit Can ask for up to 200 transactions. default: 10
83
+ # @option options [Integer] :offset Pagination help. default: 0
84
+ #
85
+ # @return [Array<Promisepay::BatchTransaction>]
86
+ def batch_transactions(options = {})
87
+ response = JSON.parse(@client.get("items/#{send(:id)}/batch_transactions", options).body)
88
+ batch_transactions = response.key?('batch_transactions') ? response['batch_transactions'] : []
89
+ batch_transactions.map { |attributes| Promisepay::BatchTransaction.new(@client, attributes) }
90
+ end
91
+
77
92
  # Show the wire details for payment.
78
93
  #
79
94
  # @see https://reference.promisepay.com/#show-item-wire-details
@@ -0,0 +1,44 @@
1
+ module Promisepay
2
+ # Resource for the Items API
3
+ class BatchTransactionResource < BaseResource
4
+ def model
5
+ Promisepay::BatchTransaction
6
+ end
7
+
8
+ # List all batch transactions
9
+ #
10
+ # @see https://reference.promisepay.com/#list-batch-transactions
11
+ #
12
+ # @param options [Hash] Optional options.
13
+ # @option options [Integer] :limit Can ask for up to 200 batch transactions. default: 10
14
+ # @option options [Integer] :offset Pagination help. default: 0
15
+ # @option options [Integer] :account_id Bank, Card, PayPal or Wallet Account ID.
16
+ # @option options [Integer] :batch_id Batch ID. This appears on a bank reference.
17
+ # @option options [Integer] :item_id Item ID.
18
+ # @option options [String] :transaction_type The type of transaction.
19
+ # Available values: payment, refund, disbursement, fee, deposit, withdrawal.
20
+ # @option options [String] :transaction_type_method The method the transaction was carried out with.
21
+ # Available values: bundle_direct_debit, direct_debit, credit_card, wire_transfer, direct_credit, paypal_payout.
22
+ # @option options [debit, credit] :direction Direction of the transaction.
23
+ # Available values: debit, credit.
24
+ #
25
+ # @return [Array<Promisepay::BatchTransaction>] List all batch transactions.
26
+ def find_all(options = {})
27
+ response = JSON.parse(@client.get('batch_transactions', options).body)
28
+ batch_transactions = response.key?('batch_transactions') ? response['batch_transactions'] : []
29
+ batch_transactions.map { |attributes| Promisepay::BatchTransaction.new(@client, attributes) }
30
+ end
31
+
32
+ # Get a single batch transaction
33
+ #
34
+ # @see https://reference.promisepay.com/#show-batch-transaction
35
+ #
36
+ # @param id [String] Transaction ID.
37
+ #
38
+ # @return [Promisepay::BatchTransaction]
39
+ def find(id)
40
+ response = JSON.parse(@client.get("batch_transactions/#{id}").body)
41
+ Promisepay::BatchTransaction.new(@client, response['batch_transactions'])
42
+ end
43
+ end
44
+ end
@@ -1,4 +1,4 @@
1
1
  # Gem version
2
2
  module Promisepay
3
- VERSION = '1.1.0'
3
+ VERSION = '1.2.0'
4
4
  end
@@ -18,10 +18,10 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ['lib']
20
20
 
21
- spec.required_ruby_version = '>= 1.9.3'
21
+ spec.required_ruby_version = '>= 2.0.0'
22
22
 
23
23
  spec.add_dependency 'faraday'
24
- spec.add_dependency 'json', '~> 1.8.3'
24
+ spec.add_dependency 'json'
25
25
  spec.add_development_dependency 'bundler', '~> 1.7'
26
26
  spec.add_development_dependency 'rake', '~> 10.0'
27
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: promisepay
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
  - Romain Vigo Benia
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-23 00:00:00.000000000 Z
11
+ date: 2016-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -28,16 +28,16 @@ dependencies:
28
28
  name: json
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 1.8.3
33
+ version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 1.8.3
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -84,6 +84,7 @@ files:
84
84
  - lib/promisepay/models/account.rb
85
85
  - lib/promisepay/models/bank_account.rb
86
86
  - lib/promisepay/models/base_model.rb
87
+ - lib/promisepay/models/batch_transaction.rb
87
88
  - lib/promisepay/models/card_account.rb
88
89
  - lib/promisepay/models/charge.rb
89
90
  - lib/promisepay/models/company.rb
@@ -97,6 +98,7 @@ files:
97
98
  - lib/promisepay/resources/account_resource.rb
98
99
  - lib/promisepay/resources/bank_account_resource.rb
99
100
  - lib/promisepay/resources/base_resource.rb
101
+ - lib/promisepay/resources/batch_transaction_resource.rb
100
102
  - lib/promisepay/resources/card_account_resource.rb
101
103
  - lib/promisepay/resources/charge_resource.rb
102
104
  - lib/promisepay/resources/company_resource.rb
@@ -123,7 +125,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
123
125
  requirements:
124
126
  - - ">="
125
127
  - !ruby/object:Gem::Version
126
- version: 1.9.3
128
+ version: 2.0.0
127
129
  required_rubygems_version: !ruby/object:Gem::Requirement
128
130
  requirements:
129
131
  - - ">="