Module: Balanced
- Defined in:
- lib/balanced.rb,
lib/balanced/error.rb,
lib/balanced/pager.rb,
lib/balanced/utils.rb,
lib/balanced/client.rb,
lib/balanced/version.rb,
lib/balanced/resources/card.rb,
lib/balanced/resources/hold.rb,
lib/balanced/resources/debit.rb,
lib/balanced/resources/event.rb,
lib/balanced/resources/credit.rb,
lib/balanced/resources/refund.rb,
lib/balanced/resources/account.rb,
lib/balanced/resources/api_key.rb,
lib/balanced/resources/callback.rb,
lib/balanced/resources/merchant.rb,
lib/balanced/resources/resource.rb,
lib/balanced/resources/marketplace.rb,
lib/balanced/resources/transaction.rb,
lib/balanced/resources/bank_account.rb
Defined Under Namespace
Modules: Resource, Utils
Classes: Account, ApiKey, BadGateway, BadRequest, BankAccount, BankAccountVerificationFailure, Callback, Card, Client, Conflict, Credit, Debit, Error, Event, EventCallback, Forbidden, FundingInstrumentVerificationError, GatewayTimeout, Gone, Hold, InternalServerError, Log, Marketplace, Merchant, MethodNotAllowed, MoreInformationRequired, NotFound, NotImplemented, Pager, PaymentRequired, Refund, ServiceUnavailable, StandardError, Transaction, Unauthorized, Verification
Constant Summary
collapse
- VERSION =
'0.6.0'
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.client ⇒ Object
Returns the value of attribute client.
24
25
26
|
# File 'lib/balanced.rb', line 24
def client
@client
end
|
.config ⇒ Object
Returns the value of attribute config.
25
26
27
|
# File 'lib/balanced.rb', line 25
def config
@config
end
|
Class Method Details
27
28
29
30
|
# File 'lib/balanced.rb', line 27
def configure(api_key=nil, options={})
@config = @config.merge(options)
@client = Balanced::Client.new(api_key, @config)
end
|
.delete(*args, &block) ⇒ Object
78
79
80
|
# File 'lib/balanced.rb', line 78
def delete(*args, &block)
self.client.delete *args
end
|
.from_uri(uri) ⇒ Object
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/balanced.rb', line 40
def from_uri uri
split_uri = split_the_uri(uri)
class_name = Balanced::Utils.classify(split_uri[-1])
begin
klass = Balanced.const_get class_name
rescue NameError
class_name = Utils.classify(split_uri[-2])
klass = Balanced.const_get(class_name)
end
klass
end
|
.get(*args, &block) ⇒ Object
66
67
68
|
# File 'lib/balanced.rb', line 66
def get(*args, &block)
self.client.get *args
end
|
.is_collection(uri) ⇒ Object
55
56
57
58
59
60
61
62
63
64
|
# File 'lib/balanced.rb', line 55
def is_collection uri
split_uri = split_the_uri(uri)
class_name = Balanced::Utils.classify(split_uri[-1])
begin
Balanced.const_get class_name
rescue NameError
return false
end
true
end
|
32
33
34
|
# File 'lib/balanced.rb', line 32
def is_configured_with_api_key?
!@client.api_key.nil?
end
|
.post(*args, &block) ⇒ Object
70
71
72
|
# File 'lib/balanced.rb', line 70
def post(*args, &block)
self.client.post *args
end
|
.put(*args, &block) ⇒ Object
74
75
76
|
# File 'lib/balanced.rb', line 74
def put(*args, &block)
self.client.put *args
end
|
.split_the_uri(uri) ⇒ Object
36
37
38
|
# File 'lib/balanced.rb', line 36
def split_the_uri uri
URI.parse(uri).path.sub(/\/$/, '').split('/')
end
|