Class: Microsoft::Graph::JSONStruct

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/microsoft/graph.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash = {}) ⇒ JSONStruct

Returns a new instance of JSONStruct.



105
106
107
108
109
110
# File 'lib/microsoft/graph.rb', line 105

def initialize(hash = {})
  super nil
  hash.each do |key, value|
    self[key] = value
  end
end

Class Method Details

.format(key) ⇒ Object



101
102
103
# File 'lib/microsoft/graph.rb', line 101

def self.format(key)
  HTTParty::Response.underscore(key.to_s).to_sym
end

Instance Method Details

#[]=(key, value) ⇒ Object



112
113
114
115
# File 'lib/microsoft/graph.rb', line 112

def []=(key, value)
  formatted_key = self.class.format(key)
  super formatted_key, value
end