Class: PlotLy
- Inherits:
-
Object
- Object
- PlotLy
- Defined in:
- lib/plotly.rb
Constant Summary collapse
- VERSION =
'0.0.1'
- PlotLyUri =
URI.parse('https://plot.ly')
- PlotLyApiVersion =
'0.1'
- PlotLyOrigins =
[:plot, :style, :layout]
Instance Method Summary collapse
-
#initialize(username, api_key, version = nil) ⇒ PlotLy
constructor
A new instance of PlotLy.
- #method_missing(sym, *args, &block) ⇒ Object
Constructor Details
#initialize(username, api_key, version = nil) ⇒ PlotLy
Returns a new instance of PlotLy.
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/plotly.rb', line 13 def initialize(username, api_key, version = nil) @username, @api_key = username, api_key @version ||= PlotLyApiVersion @plotter = Net::HTTP.new(PlotLyUri.host, PlotLyUri.port) @plotter.use_ssl = true @plotter.verify_mode = OpenSSL::SSL::VERIFY_NONE end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args, &block) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/plotly.rb', line 24 def method_missing(sym, *args, &block) raise NoMethodError if !PlotLyOrigins.include?(sym) post(sym, args[0] || [], args[1] || {}, &block) end |