Sha256: 2ebc2f2fad7d99000e4aa8c1f1039dd999ac898f7e4a7bd6c79ae37e4a08481c
Contents?: true
Size: 1.62 KB
Versions: 2
Compression:
Stored size: 1.62 KB
Contents
module MidasClient class Queries < Request include EndPoints # This method performs a query by a range date. # This is a is synchronous operation, using method GET # # Params: # start_date: date format YYYY-MM-DD # send_date: date format YYYY-MM-DD # # # Response: # result: { # success: true/false # code: "XXX" # message: "Some message to you" # } def transaction_by_date(start_date=(Date.today - 7).strftime('%Y-%m-%d'), end_date = Date.today.strftime('%Y-%m-%d'), status = nil) log "Entrei em transaction_by_date" # define o método de envio da requisição method = :get # monta a URL de chamada da requisição endpoint = EndPoints.get_env[:url] + EndPoints::QUERIES[:context] + EndPoints::QUERIES[:by_period].gsub("{startDate}", start_date).gsub("{endDate}", end_date) # monta os parâmetros da requisição na url endpoint = status.blank? ? endpoint.gsub("{status}", '') : endpoint.gsub("{status}", status) # faz a chamada a plataforma de pagamento (MIDAS) response = request(method, endpoint, self.login, self.password, {}) result = response[:result] pagging = response[:pagging] if response[:transactions].kind_of?(Array) || response[:transactions].blank? transactions = response[:transactions] else transaction_array = [] transaction_array << response[:transactions] transactions = transaction_array end return result, pagging, transactions end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
midas_client-0.1.4.1 | lib/midas_client/query.rb |
midas_client-0.1.4 | lib/midas_client/query.rb |