Class: CloudConnect::Client

Inherits:
Object
  • Object
show all
Includes:
Authentication, Assets, Channels, Configurations, Fields, Messages, Tracks, Connection, Request
Defined in:
lib/cloud_connect/client.rb,
lib/cloud_connect/client/assets.rb,
lib/cloud_connect/client/fields.rb,
lib/cloud_connect/client/tracks.rb,
lib/cloud_connect/client/channels.rb,
lib/cloud_connect/client/messages.rb,
lib/cloud_connect/client/configurations.rb

Defined Under Namespace

Modules: Assets, Channels, Configurations, Fields, Messages, Tracks

Instance Method Summary collapse

Methods included from Messages

#asset_messages, #message, #messages, #search_messages, #send_message

Methods included from Tracks

#search_tracks, #track, #tracks

Methods included from Channels

#channel, #channels, #create_channel, #delete_channel, #search_channels, #update_channel

Methods included from Fields

#create_field, #delete_field, #field, #fields, #search_fields, #update_field

Methods included from Configurations

#configuration, #configurations, #create_configuration, #search_configurations, #update_configuration

Methods included from Assets

#asset, #assets, #create_asset, #delete_asset, #search_assets, #update_asset

Methods included from Request

#delete, #get, #patch, #post, #put

Methods included from Authentication

#authenticated?, #authentication

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.



17
18
19
20
21
22
# File 'lib/cloud_connect/client.rb', line 17

def initialize(options={})
  options = CloudConnect.options.merge(options)
  Configuration::VALID_OPTIONS_KEYS.each do |key|
    send("#{key}=", options[key])
  end
end

Instance Method Details

#enhance(object, with_opts) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/cloud_connect/client.rb', line 24

def enhance(object, with_opts)
  # @private
  # Add custom methods to provided object(s).
  # This method provides syntaxic suggar upon <tt>Module.apply_to(object)</tt>,
  # allowing you to write <tt>enhance object, with: Module</tt>
  #
  # @param object [Object] An Object or Array of Objects to enhance.
  # @param with_opts [Hash] Customizable set of options.
  # @options with_opts [Module] :with Module to include.
  # @return [Object] Enhanced initial object.
  # @example Enhance an instance of Hashie::Mash with methods defined in the AssetMethods module
  #   enhance( Hashie::Mash.new, :with => AssetMethods)
  object.tap do |obj|
    with_opts[:with].apply_to(obj, client: self)
  end
end