Sha256: ca6985f5666a21e0046fd06709b8cf087d6ce4f73563ae50e0241fd51886905f
Contents?: true
Size: 871 Bytes
Versions: 7
Compression:
Stored size: 871 Bytes
Contents
require 'yaml' require 'hashie' require 'nokogiri' require 'open-uri' require 'underscore' # This task can parse the list of bungie services from *destinydevs.github.io* for client. task :parse_services do # preset services = {} response = Nokogiri::HTML open('http://destinydevs.github.io/BungieNetPlatform/docs/Endpoints') # get services response.search('.container .table tbody tr').each do |tr| tds = tr.search 'td' next if tds.nil? || tds[1].nil? service = { :name => tds[1].text, :method => (tds[0]&.text.downcase || 'get'), :endpoint => (tds[2]&.text || '') } service[:endpoint].slice! 0 services[tds[1].text.underscore] = service end # save yaml File.open "#{File.dirname(__FILE__)}/../bungie_client/services.yml", 'w' do |f| f.write services.to_yaml end p 'Services were generated...' end
Version data entries
7 entries across 7 versions & 1 rubygems