lib/nubank_sdk/credit.rb in nubank_sdk-0.7.7 vs lib/nubank_sdk/credit.rb in nubank_sdk-0.7.8
- old
+ new
@@ -38,7 +38,38 @@
response = @connection.get(feed_url)
data = Client.get_body(response)
data[:events]
end
+
+ #
+ # Returns the cards summary
+ #
+ # @return [Array<Hash>] the cards summary
+ def cards
+ # cards_url vem do 'https://prod-s7-facade.nubank.com.br/api/customers/${id}/dashboard'
+ # porem isso retorna muito dado... então vamos chumbar :D
+ customer_id = @api_routes.entrypoint(path: :ssl, entrypoint: :customer).split('/').last
+ cards_url = "https://prod-s7-mr-white.nubank.com.br/api/customers/#{customer_id}/card-summaries"
+
+ puts cards_url
+ response = @connection.get(cards_url)
+
+ data = Client.get_body(response)
+ data[:sections].map { |section| section[:cards] }.flatten
+ end
+
+ #
+ # Return details of a specific transaction from
+ # https://prod-s7-showbillz.nubank.com.br/api/items/#{transaction_id}/details
+ #
+ # @param [String] transaction_id
+ # @return [Hash] the transaction details
+ def transaction_details(transaction_id)
+ details_url = "https://prod-s7-showbillz.nubank.com.br/api/items/#{transaction_id}/details"
+
+ response = @connection.get(details_url)
+
+ Client.get_body(response)
+ end
end
end