Project

dof

0.0
No commit activity in last 3 years
No release in over 3 years
A simple service to consume Mexican DOF data
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 1.17
~> 10.0
~> 3.0
~> 0.17
~> 3.7

Runtime

~> 1.0.0
 Project Readme

DOF

A simple gem to interact with the Mexican DOF open data service

Installation

Add this line to your application's Gemfile:

gem 'dof'

And then execute:

$ bundle

Or install it yourself as:

$ gem install dof

Usage

Add a new initializer and add the following lines

require "DOF"

DOF.config do |c|
  c.base_uri = "https://sidofqa.segob.gob.mx/dof/sidof/"
end

Querying the current USD exchange rate

To get the current (daily) exchange rate call USD_exchange_rate

DOF::Indicator.USD_exchange_rate

This will return an RequestResponse object with the following attributes:

# An array of indicator objects
:indicators
# A request response confirmation
:response_code
# response status eg: 200/500
:response_status
# number of indicators found
:total_indicators

Querying the current UDIS exchange rate

To get the current (daily) exchange rate call UDIS_exchange_rate

DOF::Indicator.UDIS_exchange_rate

Querying indicators by date range

You can call USD_exchange_rate and UDIS_exchange_rate with date params

DOF::Indicator.USD_exchange_rate(date: initial_date, end_date: end_date)

The accepted date formats are:

  • String in mm/dd/YYYY format
  • String in mm-dd-YYYY format
  • String in mm.dd.YYYY format
  • Date type, eg: Date.today

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/yellowme/DOF.