# File lib/syncano/resources/api_key.rb, line 67 def self.primary_key_name :api_client_id end
class Syncano::Resources::ApiKey
Api key resource
Public Class Methods
new(client, attributes = {})
click to toggle source
Overwritten constructor with initializing associated role object @param [Syncano::Clients::Base] client @param [Hash] attributes
Calls superclass method
Syncano::Resources::Base::new
# File lib/syncano/resources/api_key.rb, line 8 def initialize(client, attributes = {}) super(client, attributes) if @attributes[:role].is_a?(Hash) @attributes[:role] = ::Syncano::Resources::Role.new(client, @attributes[:role]) end if @saved_attributes[:role].is_a?(Hash) @saved_attributes[:role] = ::Syncano::Resources::Role.new(client, @saved_attributes[:role]) end end
Private Class Methods
attributes_to_sync(attributes)
click to toggle source
Prepares attributes to synchronizing with Syncano
@param [Hash] attributes @return [Hash] prepared attributes
# File lib/syncano/resources/api_key.rb, line 58 def self.attributes_to_sync(attributes) attributes = attributes.dup attributes.delete(:role) attributes end
perform_find(client, key_name, key, scope_parameters, conditions)
click to toggle source
Executes proper find request @param [Syncano::Clients::Base] client @param [Symbol, String] key_name @param [Integer, String] key @param [Hash] scope_parameters @param [Hash] conditions @return [Syncano::Response]
# File lib/syncano/resources/api_key.rb, line 78 def self.perform_find(client, key_name, key, scope_parameters, conditions) key_parameters = key.present? ? { key_name.to_sym => key } : {} make_request(client, nil, :find, conditions.merge(scope_parameters.merge(key_parameters))) end
primary_key_name()
click to toggle source
Name of attribute used as primary key @return [Symbol]
Public Instance Methods
Private Instance Methods
perform_update(batch_client, attributes)
click to toggle source
Executes proper update request @param [Jimson::BatchClient] batch_client @param [Hash] attributes @return [Syncano::Response]
# File lib/syncano/resources/api_key.rb, line 87 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