kobana 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -12
- data/lib/{kobana_ruby_client → kobana}/base.rb +2 -2
- data/lib/{kobana_ruby_client → kobana}/configuration.rb +1 -1
- data/lib/{kobana_ruby_client → kobana}/resources/charge/bank_billet.rb +1 -1
- data/lib/{kobana_ruby_client → kobana}/resources/charge/pix.rb +1 -1
- data/lib/{kobana_ruby_client → kobana}/resources/resource_operations.rb +1 -1
- data/lib/kobana/version.rb +5 -0
- data/lib/kobana.rb +30 -0
- metadata +8 -8
- data/lib/kobana_ruby_client/version.rb +0 -5
- data/lib/kobana_ruby_client.rb +0 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e38b461dc88bcecd8dde4c85c696b588239907f531eccad3f0e06e9a895f8a5
|
4
|
+
data.tar.gz: a8c09d5b98e20f982dffbbffec3b4ce50277d09a8dbf4d65055b3767ff4cf2d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4ef8fb5d176a78645aa8fca88ce9be5208a51dee2f558107d3f274a446dbda056b47c8d67c0656f09fd1ca9571c30f1b98a2f3e27dc756ca47d4b34dc93ce4d
|
7
|
+
data.tar.gz: 1fd2fa615f8e353c17fc1bf949dd9ca7b2e03807f1819640eca8a3142fe67278dbc22edb34952d24a9959d5c97c7eea762d3ecb9ec6b99754e5620d11efc27e1
|
data/README.md
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
|
2
2
|
|
3
|
-
##
|
3
|
+
## Kobana - Ruby Client for Kobana Services
|
4
4
|
|
5
5
|
This Ruby gem provides a convenient method to interact with the Kobana APP, simplifying operations with charges and bank billets.
|
6
6
|
|
7
7
|
This is BETA and can change anytimes.
|
8
8
|
Use with caution.
|
9
9
|
|
10
|
+
[![Gem Version](https://badge.fury.io/rb/kobana.svg)](https://badge.fury.io/rb/kobana)
|
11
|
+
|
10
12
|
### Prerequisites
|
11
13
|
|
12
14
|
- Ruby version >= 3.2
|
@@ -17,7 +19,7 @@ Use with caution.
|
|
17
19
|
Add this line to your application's Gemfile:
|
18
20
|
|
19
21
|
```ruby
|
20
|
-
gem '
|
22
|
+
gem 'kobana'
|
21
23
|
```
|
22
24
|
|
23
25
|
Then execute:
|
@@ -29,17 +31,17 @@ $ bundle install
|
|
29
31
|
Or install it yourself as:
|
30
32
|
|
31
33
|
```bash
|
32
|
-
$ gem install
|
34
|
+
$ gem install kobana
|
33
35
|
```
|
34
36
|
|
35
37
|
### Configuration
|
36
38
|
|
37
39
|
Configure your API key by creating an initializer in your Rails project:
|
38
40
|
|
39
|
-
`config/initializers/
|
41
|
+
`config/initializers/kobana.rb`
|
40
42
|
|
41
43
|
```ruby
|
42
|
-
|
44
|
+
Kobana.api_key = 'YOUR_API_KEY_HERE'
|
43
45
|
```
|
44
46
|
|
45
47
|
Replace `'YOUR_API_KEY_HERE'` with your actual API key.
|
@@ -51,7 +53,7 @@ To use this gem:
|
|
51
53
|
#### **Configuration**
|
52
54
|
|
53
55
|
```ruby
|
54
|
-
|
56
|
+
Kobana.configure do |config|
|
55
57
|
config.api_token = 'YOUR_API_KEY'
|
56
58
|
config.environment = :sandbox # you can specify the environment as :development, :sandbox, or :production
|
57
59
|
config.api_version = :v1 #or :v2
|
@@ -78,7 +80,7 @@ charge_data = {
|
|
78
80
|
'custom_data' => '{"order_id": "12345"}'
|
79
81
|
}
|
80
82
|
|
81
|
-
charge =
|
83
|
+
charge = Kobana::Resources::Charge::Pix.new
|
82
84
|
result = charge.create(charge_data)
|
83
85
|
puts result
|
84
86
|
```
|
@@ -87,7 +89,7 @@ puts result
|
|
87
89
|
|
88
90
|
```ruby
|
89
91
|
charge_id = 1 # Replace with your charge ID
|
90
|
-
charge =
|
92
|
+
charge = Kobana::Resources::Charge::Pix.new
|
91
93
|
result = charge.find(charge_id)
|
92
94
|
puts result
|
93
95
|
```
|
@@ -95,7 +97,7 @@ puts result
|
|
95
97
|
##### Listing All Charges
|
96
98
|
|
97
99
|
```ruby
|
98
|
-
charge =
|
100
|
+
charge = Kobana::Resources::Charge::Pix.new
|
99
101
|
params = { status: ["opened", "overdue"], page: 2 }
|
100
102
|
results = charge.index(params)
|
101
103
|
puts result
|
@@ -108,7 +110,7 @@ puts result
|
|
108
110
|
```ruby
|
109
111
|
bank_billet_data = { ... }
|
110
112
|
|
111
|
-
bank_billet =
|
113
|
+
bank_billet = Kobana::Resources::BankBillet::BankBillet.new
|
112
114
|
result = bank_billet.create(bank_billet_data)
|
113
115
|
puts result
|
114
116
|
```
|
@@ -117,7 +119,7 @@ puts result
|
|
117
119
|
|
118
120
|
```ruby
|
119
121
|
bank_billet_id = 1 # Replace with your charge ID
|
120
|
-
bank_billet =
|
122
|
+
bank_billet = Kobana::Resources::BankBillet::BankBillet.new
|
121
123
|
result = bank_billet.find(bank_billet_id)
|
122
124
|
puts result
|
123
125
|
```
|
@@ -125,7 +127,7 @@ puts result
|
|
125
127
|
##### Listing All Bank Billets
|
126
128
|
|
127
129
|
```ruby
|
128
|
-
bank_billet =
|
130
|
+
bank_billet = Kobana::Resources::BankBillet::BankBillet.new
|
129
131
|
result = bank_billet.index
|
130
132
|
puts result
|
131
133
|
```
|
@@ -3,7 +3,7 @@
|
|
3
3
|
require "faraday"
|
4
4
|
require "json"
|
5
5
|
|
6
|
-
module
|
6
|
+
module Kobana
|
7
7
|
class Base
|
8
8
|
attr_reader :base_url, :custom_headers
|
9
9
|
|
@@ -21,7 +21,7 @@ module KobanaRubyClient
|
|
21
21
|
}.freeze
|
22
22
|
|
23
23
|
def initialize
|
24
|
-
config =
|
24
|
+
config = Kobana.configuration
|
25
25
|
|
26
26
|
@api_key = config.api_token
|
27
27
|
@base_url = BASE_URI[config.api_version][config.environment]
|
data/lib/kobana.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "faraday"
|
4
|
+
require "json"
|
5
|
+
require "kobana/configuration"
|
6
|
+
|
7
|
+
module Kobana
|
8
|
+
class << self
|
9
|
+
attr_writer :configuration
|
10
|
+
|
11
|
+
def configuration
|
12
|
+
@configuration ||= Configuration.new
|
13
|
+
end
|
14
|
+
|
15
|
+
def configure
|
16
|
+
yield(configuration) if block_given?
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
autoload :Base, "kobana/base"
|
21
|
+
autoload :Version, "kobana/version"
|
22
|
+
|
23
|
+
module Resources
|
24
|
+
autoload :ResourceOperations, "kobana/resources/resource_operations"
|
25
|
+
module Charge
|
26
|
+
autoload :Pix, "kobana/resources/charge/pix"
|
27
|
+
autoload :BankBillet, "kobana/resources/charge/bank_billet"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kobana
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kivanio Barbosa
|
@@ -55,13 +55,13 @@ files:
|
|
55
55
|
- LICENSE
|
56
56
|
- README.md
|
57
57
|
- Rakefile
|
58
|
-
- lib/
|
59
|
-
- lib/
|
60
|
-
- lib/
|
61
|
-
- lib/
|
62
|
-
- lib/
|
63
|
-
- lib/
|
64
|
-
- lib/
|
58
|
+
- lib/kobana.rb
|
59
|
+
- lib/kobana/base.rb
|
60
|
+
- lib/kobana/configuration.rb
|
61
|
+
- lib/kobana/resources/charge/bank_billet.rb
|
62
|
+
- lib/kobana/resources/charge/pix.rb
|
63
|
+
- lib/kobana/resources/resource_operations.rb
|
64
|
+
- lib/kobana/version.rb
|
65
65
|
homepage: https://www.kobana.com.br/
|
66
66
|
licenses: []
|
67
67
|
metadata:
|
data/lib/kobana_ruby_client.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "faraday"
|
4
|
-
require "json"
|
5
|
-
require "kobana_ruby_client/configuration"
|
6
|
-
|
7
|
-
module KobanaRubyClient
|
8
|
-
class << self
|
9
|
-
attr_writer :configuration
|
10
|
-
|
11
|
-
def configuration
|
12
|
-
@configuration ||= Configuration.new
|
13
|
-
end
|
14
|
-
|
15
|
-
def configure
|
16
|
-
yield(configuration) if block_given?
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
autoload :Base, "kobana_ruby_client/base"
|
21
|
-
autoload :Version, "kobana_ruby_client/version"
|
22
|
-
|
23
|
-
module Resources
|
24
|
-
autoload :ResourceOperations, "kobana_ruby_client/resources/resource_operations"
|
25
|
-
module Charge
|
26
|
-
autoload :Pix, "kobana_ruby_client/resources/charge/pix"
|
27
|
-
autoload :BankBillet, "kobana_ruby_client/resources/charge/bank_billet"
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|