column_api 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -1
- data/Gemfile.lock +1 -1
- data/README.md +21 -3
- data/lib/column_api/client.rb +4 -0
- data/lib/column_api/object.rb +7 -1
- data/lib/column_api/objects/bank_account.rb +6 -0
- data/lib/column_api/resources/bank_account_resource.rb +33 -0
- data/lib/column_api/version.rb +1 -1
- data/lib/column_api.rb +2 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f6201925587745962ca88d181952fb299995347b0bcc66581ea2d39ecccdbc6
|
4
|
+
data.tar.gz: 9053f946825a96523e0d86867ded80df66d59b6c69254d814cd24bb135367820
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4125ef91a2a974c38c935b2665bf1fb8af9e0e151bd42595e3cdb3bba7aa67e951b4c00a3b91a8a9321d3adfe49b635d3701840d178df7a5315f8174db36bcb5
|
7
|
+
data.tar.gz: ce6defb6e864690523b481813a1d0c1c0e0be8447712b73ad5c6548f294d8c3d519519b9626eb68176d4ba025165007bafa82e38ccbe83742eda70b20dd4ef75
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -9,7 +9,7 @@ Ruby bindings for [Column's API](https://column.com/docs/api).
|
|
9
9
|
## Installation
|
10
10
|
|
11
11
|
```ruby
|
12
|
-
gem 'column_api', '~> 0.0.
|
12
|
+
gem 'column_api', '~> 0.0.3'
|
13
13
|
```
|
14
14
|
|
15
15
|
## Usage
|
@@ -17,8 +17,13 @@ gem 'column_api', '~> 0.0.2'
|
|
17
17
|
```ruby
|
18
18
|
client = ColumnApi::Client.new(api_key: ENV["COLUMN_API_KEY"])
|
19
19
|
|
20
|
-
client.entities.retrieve(entity_id: "enti_2aELWf6D")
|
21
|
-
# =>
|
20
|
+
person = client.entities.retrieve(entity_id: "enti_2aELWf6D")
|
21
|
+
person.id # => enti_2Q1ctiJm1NypVqCt8UBC8e4xTfH
|
22
|
+
person.person_details.email # => oliver@column.com
|
23
|
+
|
24
|
+
bank_accounts = client.bank_accounts.list({ limit: 2 })
|
25
|
+
bank_accounts.data # => [#<ColumnApi::BankAccount>, #<ColumnApi::BankAccount>]
|
26
|
+
bank_accounts.has_more # => true
|
22
27
|
```
|
23
28
|
|
24
29
|
Alternatively, you can query the endpoints directly:
|
@@ -50,6 +55,19 @@ client.entities.delete(entity_id: "ID")
|
|
50
55
|
client.entities.submit_document(entity_id: "ID", params: {})
|
51
56
|
```
|
52
57
|
|
58
|
+
### BankAccounts
|
59
|
+
|
60
|
+
https://column.com/docs/api/#bank-account/object
|
61
|
+
|
62
|
+
```ruby
|
63
|
+
client.bank_accounts.list({})
|
64
|
+
client.bank_accounts.retrieve(bank_account_id: "ID")
|
65
|
+
client.bank_accounts.create({})
|
66
|
+
client.bank_accounts.update(bank_account_id: "ID", params: {})
|
67
|
+
client.bank_accounts.delete(bank_account_id: "ID")
|
68
|
+
client.bank_accounts.history(bank_account_id: "ID", from_date: Date, to_date: Date)
|
69
|
+
```
|
70
|
+
|
53
71
|
## Development
|
54
72
|
|
55
73
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/lib/column_api/client.rb
CHANGED
data/lib/column_api/object.rb
CHANGED
@@ -10,7 +10,13 @@ module ColumnApi
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def to_ostruct(obj)
|
13
|
-
|
13
|
+
if obj.is_a?(Hash)
|
14
|
+
OpenStruct.new(obj.transform_values { |val| to_ostruct(val) })
|
15
|
+
elsif obj.is_a?(Array)
|
16
|
+
obj.map { |o| to_ostruct(o) }
|
17
|
+
else # Assumed to be a primitive value
|
18
|
+
obj
|
19
|
+
end
|
14
20
|
end
|
15
21
|
end
|
16
22
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ColumnApi
|
4
|
+
class BankAccountResource < Resource
|
5
|
+
def list(params = {})
|
6
|
+
response = get_request("bank-accounts", params: params).body
|
7
|
+
Collection.from_response(response, key: "bank_accounts", type: BankAccount)
|
8
|
+
end
|
9
|
+
|
10
|
+
def retrieve(bank_account_id:)
|
11
|
+
BankAccount.new get_request("bank-accounts/#{bank_account_id}").body
|
12
|
+
end
|
13
|
+
|
14
|
+
def create(params)
|
15
|
+
BankAccount.new post_request("bank-accounts", body: params).body
|
16
|
+
end
|
17
|
+
|
18
|
+
def update(bank_account_id:, params:)
|
19
|
+
BankAccount.new patch_request("bank-accounts/#{bank_account_id}", body: params).body
|
20
|
+
end
|
21
|
+
|
22
|
+
def delete(bank_account_id:)
|
23
|
+
delete_request("bank-accounts/#{bank_account_id}")
|
24
|
+
true
|
25
|
+
end
|
26
|
+
|
27
|
+
def history(bank_account_id:, from_date:, to_date:)
|
28
|
+
params = { from_date: from_date.strftime("%Y-%m-%d"), to_date: to_date.strftime("%Y-%m-%d") }
|
29
|
+
|
30
|
+
BankAccount.new get_request("bank-accounts/#{bank_account_id}/history", params: params).body
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/lib/column_api/version.rb
CHANGED
data/lib/column_api.rb
CHANGED
@@ -15,9 +15,11 @@ module ColumnApi
|
|
15
15
|
autoload :Resource, "column_api/resource"
|
16
16
|
|
17
17
|
# Objects
|
18
|
+
autoload :BankAccount, "column_api/objects/bank_account"
|
18
19
|
autoload :BusinessEntity, "column_api/objects/business_entity"
|
19
20
|
autoload :PersonEntity, "column_api/objects/person_entity"
|
20
21
|
|
21
22
|
# Resources
|
23
|
+
autoload :BankAccountResource, "column_api/resources/bank_account_resource"
|
22
24
|
autoload :EntityResource, "column_api/resources/entity_resource"
|
23
25
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: column_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matias Leidemer
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -59,9 +59,11 @@ files:
|
|
59
59
|
- lib/column_api/collection.rb
|
60
60
|
- lib/column_api/errors.rb
|
61
61
|
- lib/column_api/object.rb
|
62
|
+
- lib/column_api/objects/bank_account.rb
|
62
63
|
- lib/column_api/objects/business_entity.rb
|
63
64
|
- lib/column_api/objects/person_entity.rb
|
64
65
|
- lib/column_api/resource.rb
|
66
|
+
- lib/column_api/resources/bank_account_resource.rb
|
65
67
|
- lib/column_api/resources/entity_resource.rb
|
66
68
|
- lib/column_api/version.rb
|
67
69
|
- sig/column_api.rbs
|
@@ -85,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
85
87
|
- !ruby/object:Gem::Version
|
86
88
|
version: '0'
|
87
89
|
requirements: []
|
88
|
-
rubygems_version: 3.4.
|
90
|
+
rubygems_version: 3.4.6
|
89
91
|
signing_key:
|
90
92
|
specification_version: 4
|
91
93
|
summary: Ruby bindings for Column API
|