Class: Infobip::SmsApi::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/infobip/sms_api/model/base.rb

Direct Known Subclasses

BinaryData, BinaryMessage, TextMessage

Instance Method Summary collapse

Instance Method Details

#to_hashObject



7
8
9
10
11
12
13
14
# File 'lib/infobip/sms_api/model/base.rb', line 7

def to_hash
  hash = {}
  self.instance_variables.each do |var|
    value = self.instance_variable_get(var)
    hash[var.to_s.delete('@')] = value.respond_to?(:to_hash) ? value.to_hash : value
  end
  hash
end

#to_jsonObject



16
17
18
# File 'lib/infobip/sms_api/model/base.rb', line 16

def to_json
  self.to_hash.to_json
end