Class: Panda::Cloud
Constant Summary
Constants included
from Router
Router::VAR_PATTERN
Instance Attribute Summary collapse
Attributes inherited from Base
#attributes, #errors
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Updatable
#save, #save!, #update, #update_attribute, #update_attributes, #update_attributes!
Methods inherited from Base
#changed?, #id, #id=, #inspect, #new?, #reload, sti_name, #to_json
Methods included from Finders
included
Methods included from Builders
#create, #create!, included
Methods included from Router
included, #replace_pattern_with_self_variables
Constructor Details
#initialize(attributes = {}) ⇒ Cloud
Returns a new instance of Cloud.
7
8
9
10
11
12
|
# File 'lib/panda/resources/cloud.rb', line 7
def initialize(attributes={})
super(attributes)
connection_params = Panda.connection.to_hash.merge!(:cloud_id => id)
@connection = Connection.new(connection_params)
Panda.clouds[id] = self
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_symbol, *arguments) ⇒ Object
58
59
60
61
|
# File 'lib/panda/resources/cloud.rb', line 58
def method_missing(method_symbol, *arguments)
lazy_load
super
end
|
Instance Attribute Details
#connection ⇒ Object
Returns the value of attribute connection.
5
6
7
|
# File 'lib/panda/resources/cloud.rb', line 5
def connection
@connection
end
|
Class Method Details
.connection ⇒ Object
16
17
18
|
# File 'lib/panda/resources/cloud.rb', line 16
def connection
Panda.connection
end
|
Instance Method Details
#encodings ⇒ Object
50
51
52
|
# File 'lib/panda/resources/cloud.rb', line 50
def encodings
EncodingScope.new(self)
end
|
#eu? ⇒ Boolean
33
34
35
|
# File 'lib/panda/resources/cloud.rb', line 33
def eu?
region == "eu"
end
|
#https_url ⇒ Object
27
28
29
30
31
|
# File 'lib/panda/resources/cloud.rb', line 27
def https_url
uri = URI.parse(url)
uri.scheme = "https"
uri.to_s
end
|
#profiles ⇒ Object
54
55
56
|
# File 'lib/panda/resources/cloud.rb', line 54
def profiles
ProfileScope.new(self)
end
|
#region ⇒ Object
41
42
43
44
|
# File 'lib/panda/resources/cloud.rb', line 41
def region
return "eu" if connection.api_host == Panda::EU_API_HOST
return "us" if connection.api_host == Panda::US_API_HOST
end
|
#us? ⇒ Boolean
37
38
39
|
# File 'lib/panda/resources/cloud.rb', line 37
def us?
region == "us"
end
|
#videos ⇒ Object
46
47
48
|
# File 'lib/panda/resources/cloud.rb', line 46
def videos
VideoScope.new(self)
end
|