Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/monzo/mondo-ruby
Ruby Client
https://github.com/monzo/mondo-ruby
Last synced: 5 days ago
JSON representation
Ruby Client
- Host: GitHub
- URL: https://github.com/monzo/mondo-ruby
- Owner: monzo
- License: mit
- Created: 2015-09-12T12:18:40.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2018-08-30T20:51:28.000Z (about 6 years ago)
- Last Synced: 2024-10-20T20:29:09.592Z (20 days ago)
- Language: Ruby
- Size: 55.7 KB
- Stars: 45
- Watchers: 11
- Forks: 17
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-monzo - mondo-ruby (official) - The Mondo Ruby client provides a simple Ruby interface to the Mondo API (Code & Client Libraries)
README
# Mondo Ruby Client
The Mondo Ruby client provides a simple Ruby interface to the Mondo API.
API documentation, usage guides, and setup information can be found at [getmondo.co.uk/docs](https://getmondo.co.uk/docs/).
## Initialize your client
```ruby
mondo = Mondo::Client.new(
token: YOUR_TOKEN,
account_id: YOUR_ACCOUNT_ID # recommended, but optional. If not set, the client will fetch it from the API
)
```## Configure a different API URL
```ruby
mondo.api_url = "https://otherurl.com"
```## Ping
Check your client is configured correctly
```ruby
mondo.ping
=> "pong"
```## Get Balance
```ruby
mondo.balance=> # 642, "currency"=>"GBP", "spend_today"=>0}>}
```## List Transactions
```ruby
mondo.transactions
=> [
#,
#,
#,
#,
#,
etc...
]mondo.transactions(expand: [:merchant], limit: 2, since: "2015-08-10T23:00:00Z")
=> [
#,
#,
]# Fetch a single transaction
mondo.transaction(tx_00008zvemPnUEdNo8attNB)
=> #mondo.transactions.last.merchant
=>
#"merch_000090ER75UzBxejYTIb4r", "group_id"=>"grp_00008yEdfHhvbwnQcsYryL", "created"=>"2015-09-19T09:42:16Z", "name"=>"Department Of Coffee And Social Affairs", "logo"=>"http://avatars.io/twitter/deptofcoffee/?size=large", "address"=>{"address"=>"14-16 Leather Ln", "city"=>"London", "region"=>"Greater London", "country"=>"GB", "postcode"=>"EC1N 7SU", "latitude"=>51.519348553897686, "longitude"=>-0.1090317964553833}}>
```## Update Transaction Tags
```ruby
tx = mondo.transactions.first# You can store deeply-nested key-value data on metadata. All values are stored & returned as strings.
tx.metadata[:tags] += "#expenses" # tag this "expenses"tx.save_metadata
=> true
```## Add an attachment to a transaction
```ruby
tx = mondo.transactions.firsttx.register_attachment(
file_url: "https://example.com/nyannyan.jpg",
file_type: "image/jpg"
)=> [#"attach_00009253YR2h9Besgp6aLR", "url"=>"https://example.com/nyannyan.jpg", "type"=>"image/jpg", "created"=>"2015-11-13T16:50:05Z"}>]
# And remove it again
tx.attachments.first.deregister
```## Webhooks
```ruby
# register a new web-hook
mondo.register_web_hook("http://google.com")=> [#"webhook_00009258bk4RMBeR4niFFp", "account_id"=>"acc_000091N8nkeAUWHJjR9k9J", "url"=>"http://google.com"}>]
# list webhooks
mondo.web_hooks=> [#"webhook_00009258bk4RMBeR4niFFp", "account_id"=>"acc_000091N8nkeAUWHJjR9k9J", "url"=>"http://google.com"}>]
# and remove it
mondo.web_hooks.first.delete
```
## Cards
```ruby
mondo.cards
=> [
#"card_000000", "processor_token"=>"1234", "processor"=>"gps", "account_id"=>"account_12345", "last_digits"=>"4242", "name"=>"Your Name", "expires"=>"01/2220", "status"=>"ACTIVE", "created"=>"2016-01-20T17:23:05.51Z"}>
]
```#### Freeze Card
```ruby
card.freeze
```#### Unfreeze Card
```ruby
card.unfreeze
```## Feed Items
```ruby
# Create a new feed itemmondo.create_feed_item(
title: "Foo",
image_url: "https://www.example.com/img.jpg", # small icon shown in the feed
url: "https://www.example.com", # when feed item is clicked, show this page in a webview
)
```## Tests
```
bundle exec rake spec
```We need some tests. See "Contributing"
## Contributing
Pull requests welcome!