lib/mpesa/object.rb in mpesarb-0.3.1 vs lib/mpesa/object.rb in mpesarb-0.3.2
- old
+ new
@@ -1,9 +1,13 @@
+# frozen_string_literal: true
+
require 'ostruct'
module Mpesa
class Object
+ attr_reader :attributes
+
def initialize(attributes)
@attributes = OpenStruct.new(attributes)
end
def method_missing(method, *args, &block)
@@ -11,8 +15,12 @@
attribute.is_a?(Hash) ? Object.new(attribute) : attribute
end
def respond_to_missing?(_method, _include_private = false)
true
+ end
+
+ def to_hash
+ attributes.to_h
end
end
end