Class: Plotlyrb::Grid

Inherits:
Object
  • Object
show all
Defined in:
lib/plotlyrb/grid.rb

Instance Method Summary collapse

Constructor Details

#initialize(headers) ⇒ Grid

Returns a new instance of Grid.



6
7
8
9
10
# File 'lib/plotlyrb/grid.rb', line 6

def initialize(headers)
  @headers = headers
  @https = Net::HTTP.new(ApiV2::GRIDS.host, ApiV2::GRIDS.port)
  @https.use_ssl = true
end

Instance Method Details

#create(grid_spec) ⇒ Object

data is a hash that mirrors the format of the hash in the API api.plot.ly/v2/grids#create



14
15
16
17
18
# File 'lib/plotlyrb/grid.rb', line 14

def create(grid_spec)
  request = Net::HTTP::Post.new(ApiV2::GRIDS.path, @headers)
  request.body = grid_spec.to_json
  Response.from_http_response(@https.request(request))
end