Sha256: b1666fc649892d0102a7a652747a88d6c413a6e935b465c7c477a9faa4348808

Contents?: true

Size: 470 Bytes

Versions: 4

Compression:

Stored size: 470 Bytes

Contents

class Bnet::BnetResource
  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

4 entries across 4 versions & 1 rubygems

Version Path
bnet-0.0.4 lib/bnet/bnet_resource.rb
bnet-0.0.3 lib/bnet/bnet_resource.rb
bnet-0.0.2 lib/bnet/bnet_resource.rb
bnet-0.0.1 lib/bnet/bnet_resource.rb