I’m pretty new in ruby and sketchup, and I want to create an extension, in which I have to use rest client
. I have installed on my machine Ruby
and also installed rest client
using this command
gem install rest-client -v 1.8.0
from this site
I’ve tested it in the following way
require 'rest_client'
class Register
def self.SendData()
RestClient.post('http://localhost:1334/ControllerName/ActionName', :name_of_file_param => File.new('C:\Users\UserName\Desktop\test.txt'))
end
end
and it worked fine.
The problem is when I want to run sketchup it gives me an error
Error Loading File Exporter.rb
Error: #<LoadError: cannot load such file -- rest_client>
C:/Program Files/SketchUp/SketchUp
2018/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb:54:in `require`
C:/Program Files/SketchUp/SketchUp
2018/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb:54:in `require`
C:/Users/karen/AppData/Roaming/SketchUp/SketchUp
2018/SketchUp/Plugins/AugPlugin/Register.rb:2:in `<top (required)>`
C:/Program Files/SketchUp/SketchUp
2018/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb:54:in `require`
C:/Program Files/SketchUp/SketchUp
2018/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb:54:in `require`
C:/Users/karen/AppData/Roaming/SketchUp/SketchUp
2018/SketchUp/Plugins/Exporter.rb:4:in `<top (required)>`
I suppose that I need to integrate rest client into my extension, but I don not know how to do that correctly.
Is there any example or link where I can see how to do that? Or maybe the problem is something else.