rapid7 / nexpose-client

DEPRECATED: Rapid7 Nexpose API client library written in Ruby
https://www.rapid7.com/
BSD 3-Clause "New" or "Revised" License
150 stars 103 forks source link

Nexpose client gem: Module ISO8601: method to_string bug #305

Open jbrunner-r7 opened 7 years ago

jbrunner-r7 commented 7 years ago

Expected Behavior

Current Behavior

When trying to save a site with a Schedule object, I currently get the following error:

C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/nexpose-7.1.1/lib/nexpose/util.rb:105:in to_string': undefined methodto_time' for "20181016T181411.812Z":String (NoMethodError) Did you mean? to_i from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/nexpose-7.1.1/lib/nexpose/common.rb:221:in to_h' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/nexpose-7.1.1/lib/nexpose/site.rb:428:inmap' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/nexpose-7.1.1/lib/nexpose/site.rb:428:in to_h' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/nexpose-7.1.1/lib/nexpose/site.rb:411:into_json' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/nexpose-7.1.1/lib/nexpose/site.rb:517:in save' from set-sites-schedule.rb:42:in

'

Possible Solution

By replacing the current line with the one I've specified below, I was able to save the schedule in the site. In util.rb on line 105 (https://github.com/rapid7/nexpose-client/blob/master/lib/nexpose/util.rb#L105), shouldn't the line be:

to_time(time).utc.strftime('%Y%m%dT%H%M%S.%LZ')

Steps to Reproduce (for bugs)

Ruby code that reproduces the issue:

puts "this is only an example Ruby code block"

Context

Your Environment

  • Nexpose gem version:
  • Ruby version:
  • Operating System and version:
  • Nexpose product version: