lib/egp_rates/cib.rb
def parse(raw_data)
      raw_data['d'].each_with_object(sell: {}, buy: {}) do |obj, result|
        sell_rate = obj['SellRate']
        buy_rate  = obj['BuyRate']
        currency  = obj['CurrencyID'].to_sym

        result[:sell][currency] = sell_rate
        result[:buy][currency]  = buy_rate
      end
    end
def parse(raw_data)
      raw_data['d'].each_with_object(sell: {}, buy: {}) do |obj, result|
        sell_rate = obj['SellRate']
        buy_rate  = obj['BuyRate']
        currency  = obj['CurrencyID'].to_sym

        result[:sell][currency] = sell_rate
        result[:buy][currency]  = buy_rate
      end
    end
def parse ( raw_data ) raw_data [ 'd' ] . each_with_object ( sell : { } , buy : { } ) do | obj , result | sell_rate = obj [ 'SellRate' ] buy_rate = obj [ 'BuyRate' ] currency = obj [ 'CurrencyID' ] . to_sym result [ :sell ] [ currency ] = sell_rate result [ :buy ] [ currency ] = buy_rate end end
Parse the #raw_exchange_rates returned in response
 @param [Array] of the raw_data scraped
 @return [Hash] of exchange rates for selling and buying
   {
     { sell: { SYM: rate }, { SYM: rate }, ... },
     { buy:  { SYM: rate }, { SYM: rate }, ... }
   }
Parse the #raw_exchange_rates returned in response