bitpagos 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 23eedf7f03022f97e6bbb7fc7297112d3f7f2c98
4
+ data.tar.gz: ca93af33be361f2324d17ce612bb835f5973e791
5
+ SHA512:
6
+ metadata.gz: d81dd179704b5856bc7c3480e38e81304c14cb8281ff502ce012fa3fc209b02070e6facaf280ea2c7a7627107d37732db63dc9f48c498541785290942bf7da5e
7
+ data.tar.gz: 8e469cf4a70798bb6a1da9e4be95a4f45b7d8c3b02d6361ff13378948ce767b85f2a8cfd58979a9fa959250d0bffe1095a9fc5b5663d637f4997df00a0c4f8f5
@@ -0,0 +1,4 @@
1
+ require 'rest-client'
2
+ require 'bitpagos/client'
3
+ require 'bitpagos/errors/generic_error'
4
+ require 'bitpagos/errors/invalid_api_key'
@@ -0,0 +1,44 @@
1
+ module Bitpagos
2
+ class Client
3
+ API_BASE = "https://www.bitpagos.com/api/v1".freeze
4
+
5
+ attr_accessor :headers, :api_base
6
+
7
+ def initialize(api_key)
8
+ if api_key.to_s.empty?
9
+ raise Bitpagos::Errors::InvalidApiKey.new("No API key provided")
10
+ end
11
+
12
+ @api_key = "ApiKey #{api_key}"
13
+ @headers = { authorization: @api_key, content_type: :json, accept: :json }
14
+ @api_base = API_BASE
15
+ end
16
+
17
+ def get_transaction(transaction_id)
18
+ end
19
+
20
+ def all_transactions
21
+ retrieve_transactions
22
+ end
23
+
24
+ def completed_transactions
25
+ retrieve_transactions
26
+ end
27
+
28
+ def waiting_transactions
29
+ end
30
+
31
+ def pending_transactions
32
+ end
33
+
34
+ def partially_paid_transactions
35
+ end
36
+
37
+ private
38
+
39
+ def retrieve_transactions(query = nil, transaction_id = nil)
40
+ url = "#{API_BASE}/transaction/#{transaction_id}"
41
+ RestClient.get(url, headers)
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,6 @@
1
+ module Bitpagos
2
+ module Errors
3
+ class GenericError < StandardError
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module Bitpagos
2
+ module Errors
3
+ class InvalidApiKey < GenericError
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module Bitpagos
2
+ module Errors
3
+ class InvalidQuery < GenericError
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,3 @@
1
+ module Bitpagos
2
+ VERSION = '0.2.0'
3
+ end
metadata ADDED
@@ -0,0 +1,134 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bitpagos
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ platform: ruby
6
+ authors:
7
+ - Mauro Otonelli
8
+ - Ernesto Tagwerker
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2015-12-24 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rest-client
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: '1.8'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: '1.8'
28
+ - !ruby/object:Gem::Dependency
29
+ name: rspec
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: '3.3'
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '3.3'
42
+ - !ruby/object:Gem::Dependency
43
+ name: rake
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: '10.4'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: '10.4'
56
+ - !ruby/object:Gem::Dependency
57
+ name: pry-byebug
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '3.2'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '3.2'
70
+ - !ruby/object:Gem::Dependency
71
+ name: webmock
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - "~>"
75
+ - !ruby/object:Gem::Version
76
+ version: '1.21'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: '1.21'
84
+ - !ruby/object:Gem::Dependency
85
+ name: vcr
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - "~>"
89
+ - !ruby/object:Gem::Version
90
+ version: '2.9'
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - "~>"
96
+ - !ruby/object:Gem::Version
97
+ version: '2.9'
98
+ description: Ruby wrapper for the Bitpagos payment processing API
99
+ email: hola@ombulabs.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - lib/bitpagos.rb
105
+ - lib/bitpagos/client.rb
106
+ - lib/bitpagos/errors/generic_error.rb
107
+ - lib/bitpagos/errors/invalid_api_key.rb
108
+ - lib/bitpagos/errors/invalid_query.rb
109
+ - lib/bitpagos/version.rb
110
+ homepage: http://github.com/ombulabs/bitpagos
111
+ licenses:
112
+ - MIT
113
+ metadata: {}
114
+ post_install_message:
115
+ rdoc_options: []
116
+ require_paths:
117
+ - lib
118
+ required_ruby_version: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
123
+ required_rubygems_version: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ version: '0'
128
+ requirements: []
129
+ rubyforge_project:
130
+ rubygems_version: 2.4.6
131
+ signing_key:
132
+ specification_version: 4
133
+ summary: Bitpagos payment processing
134
+ test_files: []