Module: Panda

Extended by:
Forwardable, Panda
Included in:
Panda
Defined in:
lib/panda/base.rb,
lib/panda/panda.rb,
lib/panda/config.rb,
lib/panda/errors.rb,
lib/panda/faraday.rb,
lib/panda/version.rb,
lib/panda/connection.rb,
lib/panda/proxies/proxy.rb,
lib/panda/proxies/scope.rb,
lib/panda/modules/router.rb,
lib/panda/modules/finders.rb,
lib/panda/resources/cloud.rb,
lib/panda/resources/video.rb,
lib/panda/modules/builders.rb,
lib/panda/modules/updatable.rb,
lib/panda/resources/profile.rb,
lib/panda/api_authentication.rb,
lib/panda/modules/destroyers.rb,
lib/panda/resources/encoding.rb,
lib/panda/resources/resource.rb,
lib/panda/modules/video_state.rb,
lib/panda/proxies/video_scope.rb,
lib/panda/modules/associations.rb,
lib/panda/proxies/profile_scope.rb,
lib/panda/proxies/encoding_scope.rb,
lib/panda/modules/cloud_connection.rb

Defined Under Namespace

Modules: Associations, Builders, CloudConnection, Destroyers, Finders, HttpClient, Router, Updatable, VideoState Classes: APIError, ApiAuthentication, Base, Cloud, Config, ConfigurationError, Connection, Encoding, EncodingScope, Error, Profile, ProfileScope, Proxy, Resource, Scope, ServiceNotAvailable, Video, VideoScope

Constant Summary collapse

VERSION =
"1.6.1"
API_PORT =
443
US_API_HOST =
"api.pandastream.com"
EU_API_HOST =
"api-eu.pandastream.com"

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cloudObject (readonly)

Returns the value of attribute cloud.



6
7
8
# File 'lib/panda/panda.rb', line 6

def cloud
  @cloud
end

#cloudsObject (readonly)

Returns the value of attribute clouds.



6
7
8
# File 'lib/panda/panda.rb', line 6

def clouds
  @clouds
end

#connectionObject (readonly)

Returns the value of attribute connection.



7
8
9
# File 'lib/panda/panda.rb', line 7

def connection
  @connection
end

Instance Method Details

#configure(auth_params = nil, &block) ⇒ Object

Raises:

  • (ArgumentError)


11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/panda/panda.rb', line 11

def configure(auth_params=nil, &block)
  raise ArgumentError, "missing auth params or block" unless auth_params || block_given?

  if !auth_params
    config = Config.new
    if (block.arity > 0)
      block.call(config)
    else
      config.instance_eval(&block)
    end
  elsif auth_params.is_a?(String)
    config = Config.from_panda_url(auth_params)
  else
    config = Config.from_hash(auth_params)
  end

  configure_with_auth_params(config)
  true
end

#configure_herokuObject



31
32
33
34
# File 'lib/panda/panda.rb', line 31

def configure_heroku
  configure_with_auth_params Config.from_panda_url(ENV['PANDASTREAM_URL'])
  true
end

#connect!(auth_params) ⇒ Object



36
37
38
# File 'lib/panda/panda.rb', line 36

def connect!(auth_params)
  @connection = Connection.new(auth_params)
end

#default_adapterObject



49
50
51
# File 'lib/panda/panda.rb', line 49

def default_adapter
  @adapter
end

#default_adapter=(adapter_name) ⇒ Object



45
46
47
# File 'lib/panda/panda.rb', line 45

def default_adapter=(adapter_name)
  @adapter = adapter_name.to_sym
end