Sha256: 9d4cae979d7e4444a59db4f5f01eb2064a56d598542cb6c1234e8009145d9060

Contents?: true

Size: 494 Bytes

Versions: 2

Compression:

Stored size: 494 Bytes

Contents

class Bnet::BnetResource

  PARAMS_MAPPING = []

  def initialize args = {}
    args.each do |k,v|
      instance_variable_set("@#{k}", v) unless v.nil?
    end
  end

  def self.from_api(raw_response)
    new_hash = {}
    params_mapping.each do |old_key, new_key|
      if raw_response.has_key?(old_key)
        new_hash[new_key] = raw_response[old_key]
      end
    end

    bnet_resource = self.new(new_hash)
  end

  private

  def self.params_mapping
    self::PARAMS_MAPPING
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bnet-0.0.10 lib/bnet/bnet_resource.rb
bnet-0.0.5 lib/bnet/bnet_resource.rb