class Smtpcom::Sendapi::ApiResource

Public Class Methods

build_from_response(data) click to toggle source
# File lib/smtpcom/sendapi/api_resource.rb, line 12
def self.build_from_response(data)
  new Hash[self::MAPPINGS.map { |k, v| [k.to_sym, data[v.to_s]] }] if data
end
new(attrs = {}) click to toggle source
# File lib/smtpcom/sendapi/api_resource.rb, line 6
def initialize(attrs = {})
  self.class::MAPPINGS.keys.each do |k|
    instance_variable_set("@#{k}", attrs[k]) if attrs.key? k
  end
end

Public Instance Methods

_get(*attrs) click to toggle source
# File lib/smtpcom/sendapi/api_resource.rb, line 16
def _get(*attrs)
  self.class._get(*attrs)
end
_get_raw(*attrs) click to toggle source
# File lib/smtpcom/sendapi/api_resource.rb, line 20
def _get_raw(*attrs)
  self.class._get_raw(*attrs)
end
_post(*attrs) click to toggle source
# File lib/smtpcom/sendapi/api_resource.rb, line 24
def _post(*attrs)
  self.class._post(*attrs)
end
prepare_params() click to toggle source
# File lib/smtpcom/sendapi/api_resource.rb, line 28
def prepare_params
  Hash[self.class::MAPPINGS.map { |k, v| [v, instance_variable_get("@#{k}")] }]
end