class Officepod::Base

Public Class Methods

new(command=nil, body={}, cookie="") click to toggle source
# File lib/officepod.rb, line 21
def initialize(command=nil, body={}, cookie="")
  options = {
    headers: {
      "User-Agent" => "Gate4Mobile",
      "Content-Type" => "application/x-www-form-urlencoded",
      "Accept" => "application/json"
    }
  }

  end_point = "/server/request.php"

  self.instance_variable_set("@options", options)
  self.instance_variable_set("@end_point", end_point)
  self.instance_variable_set("@command", command)
  @options[:body] = body unless body.empty?
  @options[:headers]["Cookie"] = cookie unless cookie.empty?

  validates_command
end

Public Instance Methods

operate() click to toggle source
# File lib/officepod.rb, line 41
def operate
  send(@command)
end