bitpagos 0.3.0 → 0.3.1

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: f7169a4a6edfeba0a437acea15d2ab06828e0442
4
- data.tar.gz: f9125372ab55f2f2e0fc32425ba20b50323d354a
3
+ metadata.gz: 28b6e63d61b1c9c5a7ee4ae0af71787cc04c5233
4
+ data.tar.gz: 65a45c1268f73237ef29bcc3c87e517aa754a26c
5
5
  SHA512:
6
- metadata.gz: 126f3dceab89b0a95141733b1a5f8d476aa8abf892cbc2180d6341376f3b2c3e29d75d21d301f04887b41176fb76c93e5a57265df3253eaf3153a052f3c69610
7
- data.tar.gz: 5d494319701a37422dd55964d3ad75c4702b5c16f494e511360d4974d70522be172cdac5f0b0cb8eecfeaf4e731c3de97ed020f4b085c31a0bad868e6b60c60b
6
+ metadata.gz: adbb05cff2ec909756785fb9c64751c15d8d6b9e830d23ac4504fe75db31fcb465e8cb3bf50045dcdd3d244e4e991af8dcd0af12e59dc2ed2f55a3701d7c7171
7
+ data.tar.gz: 44e277d6710cef072251ce4836cc94c073967a83b07fa6aa5aa272edfbdb2c3552aaa63f31c458db76570a37d7f7b7542ee2f40f03152a7224bc26d4b19059b3
@@ -2,3 +2,4 @@ require 'rest-client'
2
2
  require 'bitpagos/client'
3
3
  require 'bitpagos/errors/generic_error'
4
4
  require 'bitpagos/errors/invalid_api_key'
5
+ require 'bitpagos/errors/unauthorized'
@@ -51,10 +51,20 @@ module Bitpagos
51
51
 
52
52
  private
53
53
 
54
+ # Hits the Bitpagos transaction API, returns a hash with results
55
+ #
56
+ # @param [String] State (Pending, Waiting, Completed, Partially Paid)
57
+ # @param [String] Transaction ID
58
+ # @return [Hash]
54
59
  def retrieve_transactions(query = nil, transaction_id = nil)
60
+ headers.merge!(params: { status: query }) if query
55
61
  url = "#{API_BASE}/transaction/#{transaction_id}"
56
- response = RestClient.get(url, headers)
57
- JSON.parse(response)
62
+ begin
63
+ response = RestClient.get(url, headers)
64
+ JSON.parse(response)
65
+ rescue RestClient::Unauthorized => error
66
+ raise Bitpagos::Errors::Unauthorized.new(error.message)
67
+ end
58
68
  end
59
69
  end
60
70
  end
@@ -0,0 +1,6 @@
1
+ module Bitpagos
2
+ module Errors
3
+ class Unauthorized < StandardError
4
+ end
5
+ end
6
+ end
@@ -1,3 +1,3 @@
1
1
  module Bitpagos
2
- VERSION = '0.3.0'
2
+ VERSION = '0.3.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bitpagos
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
  - Mauro Otonelli
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-12-24 00:00:00.000000000 Z
12
+ date: 2015-12-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client
@@ -105,6 +105,7 @@ files:
105
105
  - lib/bitpagos/client.rb
106
106
  - lib/bitpagos/errors/generic_error.rb
107
107
  - lib/bitpagos/errors/invalid_api_key.rb
108
+ - lib/bitpagos/errors/unauthorized.rb
108
109
  - lib/bitpagos/version.rb
109
110
  homepage: http://github.com/ombulabs/bitpagos
110
111
  licenses: