Fix get_sync_data_xml for book.
This commit is contained in:
parent
caa32da02a
commit
8d09fb9dd1
|
@ -86,8 +86,8 @@ module NtuSyncPlugin
|
|||
return res
|
||||
end
|
||||
|
||||
def self.get_sync_data_xml(ntuseq, type)
|
||||
uri = URI.parse("https://my.ntu.edu.tw/achvservice/xmlpaper.asp?Seq=#{ntuseq}&type=#{type}")
|
||||
def self.get_sync_data_xml(ntuseq, type, api_name="xmlpaper")
|
||||
uri = URI.parse("https://my.ntu.edu.tw/achvservice/#{api_name}.asp?Seq=#{ntuseq}&type=#{type}")
|
||||
response = get_response(uri)
|
||||
return Nokogiri::XML(response.body)
|
||||
end
|
||||
|
@ -204,7 +204,7 @@ module NtuSyncPlugin
|
|||
Book.where(member_profile_id: mp.id).destroy
|
||||
puts "Sync_Book:... #{u_account}."
|
||||
puts ntuseq
|
||||
books_xml = get_sync_data_xml(ntuseq, "B")
|
||||
books_xml = get_sync_data_xml(ntuseq, "B", "xmlBook")
|
||||
@books = books_xml.xpath("//Book").map do |book_node|
|
||||
{
|
||||
author: (book_node>"Authors").text,
|
||||
|
|
Loading…
Reference in New Issue