0.03
No commit activity in last 3 years
No release in over 3 years
There's a lot of open issues
A Ruby wrapper for the Mondo API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 10.3
~> 2.13
~> 0.8

Runtime

>= 0
~> 1.10
~> 1.0
 Project 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.

Initialize your client

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

mondo.api_url = "https://otherurl.com"

Ping

Check your client is configured correctly

mondo.ping
=> "pong"

Get Balance

mondo.balance

=> # <Mondo::Balance {"balance"=>642, "currency"=>"GBP", "spend_today"=>0}>}

List Transactions

mondo.transactions
=> [
  #<Mondo::Transaction -7GBP LOWER EAST SIDE DELI   LONDON  EC2A  GBR tx_00008zphrT5MZQoOhLbTur>,
  #<Mondo::Transaction -5GBP SACAT MARKS & SPENCER  LONDON        GBR tx_00008zqEXy8SiMLdEqVVmT>,
  #<Mondo::Transaction -31GBP OZONE COFFEE ROASTERS  UNITED KINGDO GBR tx_00008zrYsmW9IVgPz3bUiv>,
  #<Mondo::Transaction -26GBP LAN TANA               LONDON        GBR tx_00008zru1CYoS6lW6nhpeD>,
  #<Mondo::Transaction -5GBP PRET A MANGER          LONDON        GBR tx_00008zvemPnUEdNo8attNB>,
  etc...
]

mondo.transactions(expand: [:merchant], limit: 2, since: "2015-08-10T23:00:00Z")
=> [
  #<Mondo::Transaction -6GBP OZONE COFFEE ROASTERS  LONDON        GBR tx_00008zy8VxynHJGWOqY3aD>,
  #<Mondo::Transaction -28GBP FGW SELF SERVICE       PADDINGTON    GBR tx_00008zyGtoILjhPUwlZli5>,
]

# Fetch a single transaction
mondo.transaction(tx_00008zvemPnUEdNo8attNB)
=> #<Mondo::Transaction -5GBP PRET A MANGER          LONDON        GBR tx_00008zvemPnUEdNo8attNB>

mondo.transactions.last.merchant
=>
#<Mondo::Merchant merch_000090ER75UzBxejYTIb4r {"id"=>"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

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

tx = mondo.transactions.first

tx.register_attachment(
  file_url: "https://example.com/nyannyan.jpg",
  file_type: "image/jpg"
)

=> [#<Mondo::Attachment {"id"=>"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

# register a new web-hook
mondo.register_web_hook("http://google.com")

=> [#<Mondo::WebHook {"id"=>"webhook_00009258bk4RMBeR4niFFp", "account_id"=>"acc_000091N8nkeAUWHJjR9k9J", "url"=>"http://google.com"}>]

# list webhooks
mondo.web_hooks

=> [#<Mondo::WebHook {"id"=>"webhook_00009258bk4RMBeR4niFFp", "account_id"=>"acc_000091N8nkeAUWHJjR9k9J", "url"=>"http://google.com"}>]

# and remove it

mondo.web_hooks.first.delete

Cards

mondo.cards
=> [
  #<Mondo::Card {"id"=>"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

card.freeze

Unfreeze Card

card.unfreeze

Feed Items

# Create a new feed item

mondo.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!