Sha256: 7ce950cd98ae7bf81052d23a5fe226ad13bf9ec556dfa6b76ac7be1967d36148
Contents?: true
Size: 1.45 KB
Versions: 1
Compression:
Stored size: 1.45 KB
Contents
class Syncano module Resources # Api key resource class ApiKey < ::Syncano::Resources::Base # Overwritten constructor with initializing associated role object # @param [Syncano::Clients::Base] client # @param [Hash] attributes def initialize(client, attributes = {}) super(client, attributes) if @attributes[:role].is_a?(Hash) @attributes[:role] = ::Syncano::Resources::Role.new(@attributes[:role]) end if @saved_attributes[:role].is_a?(Hash) @saved_attributes[:role] = ::Syncano::Resources::Role.new(@saved_attributes[:role]) end end private # Prepares attributes to synchronizing with Syncano # @param [Hash] attributes # @return [Hash] prepared attributes def self.attributes_to_sync(attributes) attributes = attributes.dup attributes.delete(:role) attributes end # Name of attribute used as primary key # @return [Symbol] def self.primary_key_name :api_client_id end # Executes proper update request # @param [Jimson::BatchClient] batch_client # @param [Hash] attributes # @return [Syncano::Response] def perform_update(batch_client, attributes) self.class.make_request(client, batch_client, :update_description, self.class.attributes_to_sync(attributes).merge(self.class.primary_key_name.to_sym => primary_key)) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
syncano-3.1.1.beta | lib/syncano/resources/api_key.rb |