module HabiticaClient::Restful::ClassMethods

Public Instance Methods

parse(client, attributes) click to toggle source
# File lib/habitica_client/restful.rb, line 11
def parse(client, attributes)
  new(client, remap(attributes))
end
remap(attributes) click to toggle source
# File lib/habitica_client/restful.rb, line 15
def remap(attributes)
  remapped = attributes.map do |k, v|
    [k.gsub(/([a-z\d])([A-Z])/, '\1_\2').downcase, v]
  end

  remapped.delete_if do |k, _v|
    k.match(/^_/)
  end

  Hash[remapped]
end