Sha256: 84c86ff37b5130cf7135a592610d3d21e173d70f0234a0a8aca132aef52910cf

Contents?: true

Size: 560 Bytes

Versions: 1

Compression:

Stored size: 560 Bytes

Contents

# frozen_string_literal: true

module Dribbble
  module Utils
    module Updatable
      def update(attrs)
        res = html_put "/#{self.class.api_endpoint}/#{id}" do |payload|
          self.class.available_fields.each { |f| payload[f] = attrs[f] }
        end
        @raw = JSON.parse res
        self
      end

      module ClassMethods
        def update(token, id, attrs)
          object = find token, id
          object.update attrs
        end
      end

      def self.included(base)
        base.extend(ClassMethods)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dribbble-2.0.0 lib/dribbble/utils/updatable.rb