Class: LightspeedRestaurantClient::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/lightspeed_restaurant/base.rb

Instance Method Summary collapse

Constructor Details

#initialize(data = {}) ⇒ Base

Returns a new instance of Base.



5
6
7
# File 'lib/lightspeed_restaurant/base.rb', line 5

def initialize(data = {})
  convert_to_obj(data)
end

Instance Method Details

#attributesObject



9
10
11
12
13
# File 'lib/lightspeed_restaurant/base.rb', line 9

def attributes
  instance_variables.each_with_object({}) do |instance_variable, h|
    h[instance_variable[1..instance_variable.length]] = instance_variable_get(instance_variable)
  end
end

#to_jsonObject



15
16
17
# File 'lib/lightspeed_restaurant/base.rb', line 15

def to_json
  attributes.to_json
end