bitodeme 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b98888019e9878b395b47c1dc8b36810b9c045f7
4
- data.tar.gz: fd71b503b3f8ef66e88e7c7eabd60c0bcfc6633e
3
+ metadata.gz: 6a2abc5453c8bb957b66f76b5765c4be066ba674
4
+ data.tar.gz: ee99c7698ca5f1894b1cb8ae21f5fb0a6e90dcf3
5
5
  SHA512:
6
- metadata.gz: 836f05b8fe05f6160a8f348ad0bb84b8497d42883a2b680a9eff5ca9ba7be25837aa0850c72d450114d9c80918019787441974fe6a65a90f9ca5aedaad241abd
7
- data.tar.gz: cd37897158f7ef590acf6949f8d20260be048956bb6e46dbf6a238c346adccd52864a128a169504de5dcc66c5c04ffba149f67378bb1294463ed40e3275673e1
6
+ metadata.gz: b1feeb5b3bbaa0477ee73a4daa125469eee1d72eccfc2b71fca077d6c81e1d3bbfb5abe0f8b665caf31928a4214a418cbd339b3c8dbdae25967750be550236f6
7
+ data.tar.gz: 5837c1fa77d4676fb1dc695b630666cd08a67f65a624219cb0fb78035acd0731832794a27c643cebed0e80e5217e36cca22c4bd437ec4c45ac4dc32f0c654969
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bitodeme (0.1.0)
4
+ bitodeme (0.1.1)
5
5
  dotenv (~> 2.2, >= 2.2)
6
6
  faraday (~> 0.13)
7
7
  faraday_middleware (~> 0.12)
@@ -4,20 +4,47 @@ module Bitodeme
4
4
  class Currency < Base
5
5
  private_class_method :new
6
6
 
7
- attr_reader :withdrawable,
8
- :withdraw_fee,
9
- :updated_at,
10
- :name,
11
- :min_withdrawable_amount,
12
- :min_depositable_amount,
13
- :exchangeable,
14
- :depositable,
15
- :deposit_fee,
16
- :current_status,
17
- :created_at,
18
- :code
7
+ # Short code and unique identifier
8
+ attr_reader :code
9
+
10
+ # When it is created
11
+ attr_reader :created_at
12
+
13
+ # Current status
14
+ attr_reader :current_status
15
+
16
+ # Deposit fee
17
+ attr_reader :deposit_fee
18
+
19
+ # Is it depositable?
20
+ attr_reader :depositable
21
+
22
+ # Is it open for exchange?
23
+ attr_reader :exchangeable
24
+
25
+ # Minimum depositable amount
26
+ attr_reader :min_depositable_amount
27
+
28
+ # Minimum withdrawable amount
29
+ attr_reader :min_withdrawable_amount
30
+
31
+ # Full name
32
+ attr_reader :name
33
+
34
+ # Last updated at
35
+ attr_reader :updated_at
36
+
37
+ # Withdraw fee
38
+ attr_reader :withdraw_fee
39
+
40
+ # Is it withdrawable?
41
+ attr_reader :withdrawable
19
42
 
20
43
  class << self
44
+ # List all currencies
45
+ #
46
+ # Arguments:
47
+ # options: (Hash)
21
48
  def all(options = {})
22
49
  items = _all('currencies', options)
23
50
  items.map { |item| new(item) }
@@ -4,12 +4,17 @@ module Bitodeme
4
4
  class Deposit < Base
5
5
  private_class_method :new
6
6
 
7
+ # Unique identifier
7
8
  attr_reader :id
8
9
 
9
10
  class << self
10
11
  PLURAL = 'deposits'.freeze
11
12
  SINGULAR = 'deposit'.freeze
12
13
 
14
+ # List all deposits
15
+ #
16
+ # Arguments:
17
+ # options: (Hash)
13
18
  def all(options = {})
14
19
  items = _all(PLURAL, options)
15
20
  items.map { |item| new(item) }
@@ -4,22 +4,44 @@ module Bitodeme
4
4
  class Fund < Base
5
5
  private_class_method :new
6
6
 
7
- attr_reader :account_id,
8
- :amount,
9
- :currency_code,
10
- :current_status,
11
- :id,
12
- :updated_at
7
+ # Account identifier
8
+ attr_reader :account_id
9
+
10
+ # Current balance
11
+ attr_reader :amount
12
+
13
+ # When it is created
14
+ attr_reader :created_at
15
+
16
+ # Currency code
17
+ attr_reader :currency_code
18
+
19
+ # Current status
20
+ attr_reader :current_status
21
+
22
+ # Unique identifier
23
+ attr_reader :id
24
+
25
+ # Updated at in milliseconds
26
+ attr_reader :updated_at
13
27
 
14
28
  class << self
15
29
  PLURAL = 'funds'.freeze
16
30
  SINGULAR = 'fund'.freeze
17
31
 
18
- def find(code)
19
- item = _find(PLURAL, SINGULAR, code)
32
+ # Find a fund
33
+ #
34
+ # Arguments:
35
+ # id: (UUID)
36
+ def find(id)
37
+ item = _find(PLURAL, SINGULAR, id)
20
38
  new(item)
21
39
  end
22
40
 
41
+ # List all funds
42
+ #
43
+ # Arguments:
44
+ # options: (Hash)
23
45
  def all(options = {})
24
46
  items = _all(PLURAL, options)
25
47
  items.map { |item| new(item) }
@@ -4,25 +4,50 @@ module Bitodeme
4
4
  class FundAddress < Base
5
5
  private_class_method :new
6
6
 
7
- attr_reader :account_id,
8
- :address,
9
- :created_at,
10
- :currency_code,
11
- :current_status,
12
- :fund_id,
13
- :id,
14
- :is_temporary,
15
- :updated_at
7
+ # Account identifier
8
+ attr_reader :account_id
9
+
10
+ # Address (like Bank IBAN, or BTC address)
11
+ attr_reader :address
12
+
13
+ # Created at in milliseconds
14
+ attr_reader :created_at
15
+
16
+ # Currency code
17
+ attr_reader :currency_code
18
+
19
+ # Current status
20
+ attr_reader :current_status
21
+
22
+ # Fund id
23
+ attr_reader :fund_id
24
+
25
+ # Unique identifier
26
+ attr_reader :id
27
+
28
+ # Is it a temporary address?
29
+ attr_reader :is_temporary
30
+
31
+ # Updated at in milliseconds
32
+ attr_reader :updated_at
16
33
 
17
34
  class << self
18
35
  PLURAL = 'fund_addresses'.freeze
19
36
  SINGULAR = 'fund_address'.freeze
20
37
 
21
- def find(code)
22
- item = _find(PLURAL, SINGULAR, code)
38
+ # Find a fund address
39
+ #
40
+ # Arguments:
41
+ # id: (UUID)
42
+ def find(id)
43
+ item = _find(PLURAL, SINGULAR, id)
23
44
  new(item)
24
45
  end
25
46
 
47
+ # List all fund addresses
48
+ #
49
+ # Arguments:
50
+ # options: (Hash)
26
51
  def all(options = {})
27
52
  items = _all(PLURAL, options)
28
53
  items.map { |item| new(item) }
@@ -4,35 +4,100 @@ module Bitodeme
4
4
  class Invoice < Base
5
5
  private_class_method :new
6
6
 
7
- attr_reader :account_id,
8
- :address,
9
- :amount,
10
- :created_at,
11
- :currency_code,
12
- :current_status,
13
- :deleted_at,
14
- :description,
15
- :external_id,
16
- :id,
17
- :name,
18
- :original_amount,
19
- :original_currency_code,
20
- :purchasable,
21
- :updated_at
7
+ # Account identifier
8
+ attr_reader :account_id
9
+
10
+ # Fund address
11
+ attr_reader :address
12
+
13
+ # Amount
14
+ attr_reader :amount
15
+
16
+ # Created at in milliseconds
17
+ attr_reader :created_at
18
+
19
+ # Currency code
20
+ attr_reader :currency_code
21
+
22
+ # Current status
23
+ attr_reader :current_status
24
+
25
+ # Deleted at in milliseconds
26
+ attr_reader :deleted_at
27
+
28
+ # Description
29
+ attr_reader :description
30
+
31
+ # External unique identifier
32
+ attr_reader :external_id
33
+
34
+ # Unique identifier
35
+ attr_reader :id
36
+
37
+ # Name/title
38
+ attr_reader :name
39
+
40
+ # Original amount
41
+ attr_reader :original_amount
42
+
43
+ # Original currency code
44
+ attr_reader :original_currency_code
45
+
46
+ # Is it purchasable
47
+ attr_reader :purchasable
48
+
49
+ # Updated at in milliseconds
50
+ attr_reader :updated_at
22
51
 
23
52
  class << self
24
53
  PLURAL = 'invoices'.freeze
25
54
  SINGULAR = 'invoice'.freeze
26
55
 
56
+ # Build an invoice
57
+ #
58
+ # Example:
59
+ # >> invoice =
60
+ # >> Bitodeme.build_invoice(
61
+ # >> name: 'Virtual game gold',
62
+ # >> description: 'Buy a game gold',
63
+ # >> original_amount: 16.7,
64
+ # >> original_currency_code: 'USD',
65
+ # >> external_id: 'SomeUniqId',
66
+ # >> purchasable: {}
67
+ # >> )
68
+ #
69
+ # Arguments:
70
+ # params: (Hash)
27
71
  def build(params)
28
72
  new(params).validate
29
73
  end
30
74
 
31
- def find(code)
32
- item = _find(PLURAL, SINGULAR, code)
75
+ # Find an invoice
76
+ #
77
+ # Arguments:
78
+ # id: (UUID)
79
+ def find(id)
80
+ item = _find(PLURAL, SINGULAR, id)
33
81
  new(item)
34
82
  end
35
83
 
84
+ # Craete a new invoice
85
+ #
86
+ # Example:
87
+ # >> invoice =
88
+ # >> Bitodeme.build_invoice(
89
+ # >> name: 'Virtual game gold',
90
+ # >> description: 'Buy a game gold',
91
+ # >> original_amount: 16.7,
92
+ # >> original_currency_code: 'USD',
93
+ # >> external_id: 'SomeUniqId',
94
+ # >> purchasable: {}
95
+ # >> )
96
+ #
97
+ # >> invoice = Bitodeme.create_invoice(invoice)
98
+ #
99
+ # Arguments:
100
+ # invoice: (Bitodeme::Resource::Invoice)
36
101
  def create(invoice)
37
102
  raise_for('invoice', invoice) unless invoice.is_a?(Invoice)
38
103
  item = _create(PLURAL, SINGULAR, invoice: invoice.to_h)
@@ -4,27 +4,56 @@ module Bitodeme
4
4
  class TransactionLog < Base
5
5
  private_class_method :new
6
6
 
7
- attr_reader :account_id,
8
- :amount,
9
- :created_at,
10
- :currency_code,
11
- :current_status,
12
- :description,
13
- :fund_id,
14
- :id,
15
- :transactable_id,
16
- :transactable_type,
17
- :updated_at
7
+ # Account identifier
8
+ attr_reader :account_id
9
+
10
+ # Amount
11
+ attr_reader :amount
12
+
13
+ # Created at in milliseconds
14
+ attr_reader :created_at
15
+
16
+ # Currency code
17
+ attr_reader :currency_code
18
+
19
+ # Current status
20
+ attr_reader :current_status
21
+
22
+ # Description
23
+ attr_reader :description
24
+
25
+ # Fund identifier
26
+ attr_reader :fund_id
27
+
28
+ # Unique identifier
29
+ attr_reader :id
30
+
31
+ # Polymorphic relation identifier for transaction
32
+ attr_reader :transactable_id
33
+
34
+ # Polymorphic relation type for transaction
35
+ attr_reader :transactable_type
36
+
37
+ # Updated at in milliseconds
38
+ attr_reader :updated_at
18
39
 
19
40
  class << self
20
41
  PLURAL = 'transaction_logs'.freeze
21
42
  SINGULAR = 'transaction_log'.freeze
22
43
 
23
- def find(code)
24
- item = _find(PLURAL, SINGULAR, code)
44
+ # Find a transaction log
45
+ #
46
+ # Arguments:
47
+ # id: (UUID)
48
+ def find(id)
49
+ item = _find(PLURAL, SINGULAR, id)
25
50
  new(item)
26
51
  end
27
52
 
53
+ # List all transaction logs
54
+ #
55
+ # Arguments:
56
+ # options: (Hash)
28
57
  def all(options = {})
29
58
  items = _all(PLURAL, options)
30
59
  items.map { |item| new(item) }
@@ -4,19 +4,56 @@ module Bitodeme
4
4
  class Withdrawal < Base
5
5
  private_class_method :new
6
6
 
7
- attr_reader :address,
8
- :amount,
9
- :fund_id,
10
- :otp_value
7
+ # Address
8
+ attr_reader :address
9
+
10
+ # Amount
11
+ attr_reader :amount
12
+
13
+ # Fund identifier
14
+ attr_reader :fund_id
15
+
16
+ # One time password value gathered from Google Authenticator
17
+ attr_reader :otp_value
11
18
 
12
19
  class << self
13
20
  PLURAL = 'withdrawals'.freeze
14
21
  SINGULAR = 'withdrawal'.freeze
15
22
 
23
+ # Build a withdrawal object
24
+ #
25
+ # Example:
26
+ # >> fund_id = '12b241a7-941e-43a8-878e-a467809e988e'
27
+ # >> withdrawal =
28
+ # >> Bitodeme.build_withdrawal(
29
+ # >> amount: 16.7,
30
+ # >> address: 'USD',
31
+ # >> fund_id: fund_id,
32
+ # >> otp_value: 123456 # otp value from Google Authenticator
33
+ # >> )
34
+ #
35
+ # Arguments:
36
+ # params: (Hash)
16
37
  def build(params)
17
38
  new(params).validate
18
39
  end
19
40
 
41
+ # Craete a new withdrawal(send money)
42
+ #
43
+ # Example:
44
+ # >> fund_id = '12b241a7-941e-43a8-878e-a467809e988e'
45
+ # >> withdrawal =
46
+ # >> Bitodeme.build_withdrawal(
47
+ # >> amount: 16.7,
48
+ # >> address: 'USD',
49
+ # >> fund_id: fund_id,
50
+ # >> otp_value: 123456 # otp value from Google Authenticator
51
+ # >> )
52
+ #
53
+ # >> withdrawal = Bitodeme.create_withdrawal(withdrawal)
54
+ #
55
+ # Arguments:
56
+ # withdrawal: (Bitodeme::Resource::Withdrawal)
20
57
  def create(withdrawal)
21
58
  raise_for('withdrawal') unless withdrawal.is_a?(Withdrawal)
22
59
  item = _create(PLURAL, SINGULAR, withdrawal: withdrawal.to_h)
@@ -1,3 +1,3 @@
1
1
  module Bitodeme
2
- VERSION = '0.1.1'.freeze
2
+ VERSION = '0.1.2'.freeze
3
3
  end
data/lib/bitodeme.rb CHANGED
@@ -15,31 +15,31 @@ require_relative 'bitodeme/resources/invoice'
15
15
  require_relative 'bitodeme/resources/transaction_log'
16
16
  require_relative 'bitodeme/resources/withdrawal'
17
17
 
18
- # Base module for Bitodome Client
18
+ Currency = Bitodeme::Resource::Currency
19
+ Deposit = Bitodeme::Resource::Deposit
20
+ Fund = Bitodeme::Resource::Fund
21
+ FundAddress = Bitodeme::Resource::FundAddress
22
+ Invoice = Bitodeme::Resource::Invoice
23
+ TransactionLog = Bitodeme::Resource::TransactionLog
24
+ Withdrawal = Bitodeme::Resource::Withdrawal
25
+
26
+ # Base module for Bitodome client
19
27
  module Bitodeme
20
28
  extend SingleForwardable
21
29
 
22
- @Currency = Bitodeme::Resource::Currency
23
- @Deposit = Bitodeme::Resource::Deposit
24
- @Fund = Bitodeme::Resource::Fund
25
- @FundAddress = Bitodeme::Resource::FundAddress
26
- @Invoice = Bitodeme::Resource::Invoice
27
- @TransactionLog = Bitodeme::Resource::TransactionLog
28
- @Withdrawal = Bitodeme::Resource::Withdrawal
29
-
30
- def_delegator :@Currency, :all, :currencies
31
- def_delegator :@Deposit, :all, :deposits
32
- def_delegator :@Fund, :find, :fund
33
- def_delegator :@Fund, :all, :funds
34
- def_delegator :@FundAddress, :find, :fund_address
35
- def_delegator :@FundAddress, :all, :fund_addresses
36
- def_delegator :@Invoice, :build, :build_invoice
37
- def_delegator :@Invoice, :create, :create_invoice
38
- def_delegator :@Invoice, :find, :invoice
39
- def_delegator :@TransactionLog, :find, :transaction_log
40
- def_delegator :@TransactionLog, :all, :transaction_logs
41
- def_delegator :@Withdrawal, :build, :build_withdrawal
42
- def_delegator :@Withdrawal, :create, :create_withdrawal
30
+ def_delegator :Currency, :all, :currencies
31
+ def_delegator :Deposit, :all, :deposits
32
+ def_delegator :Fund, :find, :fund
33
+ def_delegator :Fund, :all, :funds
34
+ def_delegator :FundAddress, :find, :fund_address
35
+ def_delegator :FundAddress, :all, :fund_addresses
36
+ def_delegator :Invoice, :build, :build_invoice
37
+ def_delegator :Invoice, :create, :create_invoice
38
+ def_delegator :Invoice, :find, :invoice
39
+ def_delegator :TransactionLog, :find, :transaction_log
40
+ def_delegator :TransactionLog, :all, :transaction_logs
41
+ def_delegator :Withdrawal, :build, :build_withdrawal
42
+ def_delegator :Withdrawal, :create, :create_withdrawal
43
43
 
44
44
  def config
45
45
  Bitodeme::Configuration.instance
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bitodeme
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bitodeme Integrations Team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-12-17 00:00:00.000000000 Z
11
+ date: 2017-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -180,7 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
180
180
  version: '0'
181
181
  requirements: []
182
182
  rubyforge_project:
183
- rubygems_version: 2.6.14
183
+ rubygems_version: 2.6.11
184
184
  signing_key:
185
185
  specification_version: 4
186
186
  summary: Bitodeme REST API Client