Class: Dropbox::API::Object
- Inherits:
-
Hashie::Mash
- Object
- Hashie::Mash
- Dropbox::API::Object
- Defined in:
- lib/dropbox-api/objects/object.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
Class Method Summary collapse
- .convert(array_or_object, client) ⇒ Object
- .init(response, client) ⇒ Object
- .resolve_class(hash) ⇒ Object
Instance Method Summary collapse
-
#deep_update(other_hash) ⇒ Object
Kill off the ability for recursive conversion.
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
5 6 7 |
# File 'lib/dropbox-api/objects/object.rb', line 5 def client @client end |
Class Method Details
.convert(array_or_object, client) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/dropbox-api/objects/object.rb', line 17 def self.convert(array_or_object, client) if array_or_object.is_a?(Array) array_or_object.collect do |item| resolve_class(item).init(item, client) end else resolve_class(array_or_object).init(array_or_object, client) end end |
.init(response, client) ⇒ Object
7 8 9 10 11 |
# File 'lib/dropbox-api/objects/object.rb', line 7 def self.init(response, client) instance = self.new(response) instance.client = client instance end |
Instance Method Details
#deep_update(other_hash) ⇒ Object
Kill off the ability for recursive conversion
28 29 30 31 32 33 34 |
# File 'lib/dropbox-api/objects/object.rb', line 28 def deep_update(other_hash) other_hash.each_pair do |k,v| key = convert_key(k) regular_writer(key, convert_value(v, true)) end self end |