Class: Leetchi::Wallet

Inherits:
Ressource show all
Defined in:
lib/leetchi/wallet.rb

Class Method Summary collapse

Class Method Details

.create(data) ⇒ Object

Create a Wallet

  • Args :

    • data -> A JSON with the following attributes (Square brackets for optionals):

      * [Tag]
      * Owners (an array of user IDs, but only one is supported now)
      * [Name]
      * [Description]
      * [RaisingGoalAmount]
      * [ContributionLimitDate]
      
  • Returns :

    • A wallet object



17
18
19
# File 'lib/leetchi/wallet.rb', line 17

def self.create(data)
  post_request('wallets', data)
end

.details(wallet_id) ⇒ Object

Get a wallet

  • Args :

    • wallet_id -> The id of the wallet you want to retrieve

  • Returns :

    • A wallet object



28
29
30
# File 'lib/leetchi/wallet.rb', line 28

def self.details(wallet_id)
  get_request(File.join('wallets', wallet_id.to_s))
end

.get_contributors(wallet_id) ⇒ Object

Get the contributors of a wallet

  • Args :

    • wallet_id -> The id of the wallet you want to retrieve the contributors from

  • Returns :

    • An array of users objects



67
68
69
# File 'lib/leetchi/wallet.rb', line 67

def self.get_contributors(wallet_id)
  get_request(File.join('wallets', wallet_id.to_s, 'users'), 'contributors=1')
end

.get_owners(wallet_id) ⇒ Object

Get the owners of a wallet

  • Args :

    • wallet_id -> The id of the wallet you want to retrieve the owners from

  • Returns :

    • An array of users objects



56
57
58
# File 'lib/leetchi/wallet.rb', line 56

def self.get_owners(wallet_id)
  get_request(File.join('wallets', wallet_id.to_s, 'users'), 'owners=1')
end

.get_refunded(wallet_id) ⇒ Object

Get the refunded users of a wallet

  • Args :

    • wallet_id -> The id of the wallet you want to refunded users the owners from

  • Returns :

    • An array of users objects



78
79
80
# File 'lib/leetchi/wallet.rb', line 78

def self.get_refunded(wallet_id)
  get_request(File.join('wallets', wallet_id.to_s, 'users'), 'refunded=1')
end

.operations(wallet_id) ⇒ Object

Get the operations for a given wallet

  • Args :

    • wallet_id -> The is of the wallet you want to retrieve operations from

  • Returns :

    • An array of operations objects



89
90
91
# File 'lib/leetchi/wallet.rb', line 89

def self.operations(wallet_id)
  get_request(File.join('wallets', wallet_id.to_s, 'operations'))
end

.update(wallet_id, data) ⇒ Object

Update a wallet

  • Args :

    • wallet_id -> The id of the wallet you want to update

    • data -> A JSON with the following attributes (Square brackets for optionals):

      * [Name]
      * [Description]
      * [RaisingGoalAmount]
      * [SuggestedAmount]
      * [ExpirationDate] [Tag]
      
  • Returns :

    • A wallet object



45
46
47
# File 'lib/leetchi/wallet.rb', line 45

def self.update(wallet_id, data)
  put_request(File.join('wallets', wallet_id.to_s), data)
end