Build an Unsplash object with the given attributes.
 @param attrs [Hash]
 (Re)load full object details from Unsplash.
 @return [Unspash::Client] Itself, with full details reloaded.
176113
def reload!
      if links && links["self"]
        attrs = JSON.parse(connection.get(links["self"]).body)
        @attributes = OpenStruct.new(attrs)
        self
      else
        raise Unsplash::Error.new "Missing self link for #{self.class} with ID #{self.id}"
      end
    end
21578
def update_attrs(node, attrs, merge = false)
      return false unless attrs
      # keep the current tags
      attrs['tags'] = node.normal.tags || []
      original = Marshal.load(Marshal.dump(node.normal))
      node.normal = if merge
                      Chef::Mixin::DeepMerge.merge(node.normal, attrs)
                    else
                      attrs
                    end
      original != node.normal
    end
336334
def unwrap(obj, attr):
    
    f = getattr(obj, attr, None)
    if f and isinstance(f, wrapt.ObjectProxy) and hasattr(f, '__wrapped__'):
        setattr(obj, attr, f.__wrapped__)
1260076
def build_attr(self, attrs):
        
        """
        attrs = sorted(attrs.iteritems(), key=lambda x: x[0])
        return ' '.join(map(lambda x: '%s="%s"' % x, attrs))
1165936
def prepare_model(self, attrs):
        
        if isinstance(attrs, Model):
            attrs.client = self.client
            attrs.collection = self
            return attrs
        elif isinstance(attrs, dict):
            return self.model(attrs=attrs, client=self.client, collection=self)
        else:
            raise Exception("Can't create %s from %s" %
                            (self.model.__name__, attrs))
593988
def attributes(atts = {}, for_definition = false)
      wrapped_attributes atts, for_definition
      attributes_assignments atts, false, for_definition
      atts
    end
707089
def convert_attrs(str, attrs)
      # first do matching ones
      tags = MATCHING_WORD_PAIRS.keys.join("")
      re = "(^|\\W)([#{tags}])([A-Za-z_]+?)\\2(\\W|\$)"
#      re = "(^|\\W)([#{tags}])(\\S+?)\\2(\\W|\$)"
      1 while str.gsub!(Regexp.new(re)) {
        attr = MATCHING_WORD_PAIRS[$2];
        attrs.set_attrs($`.length + $1.length + $2.length, $3.length, attr)
        $1 + NULL*$2.length + $3 + NULL*$2.length + $4
      }

      # then non-matching
      unless WORD_PAIR_MAP.empty?
        WORD_PAIR_MAP.each do |regexp, attr|
          str.gsub!(regexp) { 
            attrs.set_attrs($`.length + $1.length, $2.length, attr)
            NULL*$1.length + $2 + NULL*$3.length
          }
        end
      end
    end
41457
def attrs
      atrs = { :has_children => 1, :name => name, :description => description }

      if !self.id.nil?
        atrs.merge!(:principal_id => self.id)
      else
        atrs.merge!(
          :type => 'group'
        )
      end
      atrs
    end
250164
def unstructure_attrs_astuple(self, obj):
        # type: (Any) -> Tuple
        """"""
        attrs = obj.__class__.__attrs_attrs__
        return tuple(self.unstructure(getattr(obj, a.name)) for a in attrs)
434811
function(attr) {
        var start;
        var end;
        var attributes = this.attributes;

        this.runtimeAttributes[attr] = {};
        
        var isset = function(prop) {
            return (typeof prop !== 'undefined');
        };
        
        if ( !isset(attributes[attr]['to']) && !isset(attributes[attr]['by']) ) {
            return false; // note return; nothing to animate to
        }
        
        start = ( isset(attributes[attr]['from']) ) ? attributes[attr]['from'] : this.getAttribute(attr);

        // To beats by, per SMIL 2.1 spec
        if ( isset(attributes[attr]['to']) ) {
            end = attributes[attr]['to'];
        } else if ( isset(attributes[attr]['by']) ) {
            if (start.constructor == Array) {
                end = [];
                for (var i = 0, len = start.length; i < len; ++i) {
                    end[i] = start[i] + attributes[attr]['by'][i] * 1; // times 1 to cast "by" 
                }
            } else {
                end = start + attributes[attr]['by'] * 1;
            }
        }
        
        this.runtimeAttributes[attr].start = start;
        this.runtimeAttributes[attr].end = end;

        // set units if needed
        this.runtimeAttributes[attr].unit = ( isset(attributes[attr].unit) ) ?
                attributes[attr]['unit'] : this.getDefaultUnit(attr);
        return true;
    }
268619
def _add_hash(cls, attrs):
    
    cls.__hash__ = _make_hash(attrs, frozen=False, cache_hash=False)
    return cls
970573
def unstructure_attrs_asdict(self, obj):
        # type: (Any) -> Dict[str, Any]
        """"""
        attrs = obj.__class__.__attrs_attrs__
        dispatch = self._unstructure_func.dispatch
        rv = self._dict_factory()
        for a in attrs:
            name = a.name
            v = getattr(obj, name)
            rv[name] = dispatch(v.__class__)(v)
        return rv
811752
def attributes=(attributes = {})
      attributes.each_pair { |k, v|
        respond_to?(name = "#{k}=") and send(name, v) or self[k] = v
      }
    end
879868
def attribute(*args)
      if args.first.is_a?(Hash)
        args.first.each_pair do |key, name|
          @attributes.add(name: name, attr: key)
        end
      else
        options = args.extract_options!
        args.each do |name|
          key = options[:as] || name
          @attributes.add(name: name, attr: key)
        end
      end
    end
399791
def load(attributes)
      raise ArgumentError, "expected an attributes Hash, got #{attributes.inspect}" unless attributes.is_a?(Hash)
      @prefix_options, attributes = split_options(attributes)
      attributes.each do |key, value|
        @attributes[key.to_s] = typecast_attribute_value(key, value)
      end
      self
    end
1270087
function attrsToString(attrs) {
  return Object.keys(attrs)
    .map(key => `${key}="${attrs[key]}"`)
    .join(' ');
}
771377
def to_hash
      hash = {}
      hash["attrs"] = @attrs

      self.instance_variables.keep_if { |key| key != :@attrs }.each do |var|
        val = self.instance_variable_get(var)
        hash["attrs"][var.to_s.delete("@").to_sym] = val.to_hash if val.is_a? ACTV::Base
      end

      hash["attrs"]
    end