Sha256: b264b6ec9038378cc3ff2bbc2a411c2432f46606fb28bd3e78576bd529eb918d
Contents?: true
Size: 1.53 KB
Versions: 1
Compression:
Stored size: 1.53 KB
Contents
module T2Airtime # Proxy transactions information class TransactionsController < ApplicationController def index @transactions = T2Airtime::API.api.transaction_list parse_time_param(permitted_params[:start]), parse_time_param(permitted_params[:stop]), permitted_params[:msisdn], permitted_params[:destination], permitted_params[:code] if @transactions.success? render_data T2Airtime::Transaction.serialize @transactions.data else render_error T2Airtime::Error.new @transactions.error_code, @transactions.error_message end end def show @transaction = T2Airtime::API.api.transaction_info(params[:id]) if @transaction.success? render_data T2Airtime::Transaction.serialize_one @transaction.data, @transaction.headers[:date] else render_error T2Airtime::Error.new @transaction.error_code, @transaction.error_message end end private def parse_time_param(timestr) Time.zone.parse(timestr) rescue nil end def permitted_params filter_params.permit( :msisdn, :destination, :code, :start, :stop ) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
t2_airtime-0.3.1 | app/controllers/t2_airtime/transactions_controller.rb |