Module: Rubyprot
- Defined in:
- lib/rubyprot.rb,
lib/rubyprot/storage.rb,
lib/rubyprot/serializer.rb,
lib/rubyprot/deserializer.rb
Defined Under Namespace
Classes: Deserializer, Serializer, Storage
Class Attribute Summary collapse
-
.amazon_access_key_id ⇒ Object
amazon access key.
-
.amazon_bucket_name ⇒ Object
amazon s3 bucket for file storage.
-
.amazon_secret_access_key ⇒ Object
amazon secret key.
-
.dump_path ⇒ Object
top level path where temporary files will be placed.
Class Method Summary collapse
-
.aws_download(location, name) ⇒ Object
Downloads file from amazon using
amazon_bucket_name
,amazon_access_key_id
,amazon_secret_access_key
attributes todump_path
. -
.aws_upload(location, name) ⇒ Object
Downloads file from amazon using using
amazon_bucket_name
,amazon_access_key_id
,amazon_secret_access_key
to givenlocation
on s3. -
.configure {|_self| ... } ⇒ Object
Allows block configuration of Rubyprot attributes.
-
.deserialize(name) ⇒ Object
Unmarshals named file from the folder specified by the
dump_path
attribute. -
.serialize(object) ⇒ Object
Marshals any object into a file named after the object class and stores the file in the folder specified by the
dump_path
attribute.
Class Attribute Details
.amazon_access_key_id ⇒ Object
amazon access key
22 23 24 |
# File 'lib/rubyprot.rb', line 22 def amazon_access_key_id @amazon_access_key_id end |
.amazon_bucket_name ⇒ Object
amazon s3 bucket for file storage
20 21 22 |
# File 'lib/rubyprot.rb', line 20 def amazon_bucket_name @amazon_bucket_name end |
.amazon_secret_access_key ⇒ Object
amazon secret key
24 25 26 |
# File 'lib/rubyprot.rb', line 24 def amazon_secret_access_key @amazon_secret_access_key end |
.dump_path ⇒ Object
top level path where temporary files will be placed
18 19 20 |
# File 'lib/rubyprot.rb', line 18 def dump_path @dump_path end |
Class Method Details
.aws_download(location, name) ⇒ Object
Downloads file from amazon using amazon_bucket_name
, amazon_access_key_id
, amazon_secret_access_key
attributes to dump_path
.
Returns the file name for use to deserialize object
Rubyprot.deserialize(Rubyprot.aws_download("path_to_data", "Object"))
65 66 67 |
# File 'lib/rubyprot.rb', line 65 def aws_download(location, name) return Rubyprot::Storage.aws_download(location, name) end |
.aws_upload(location, name) ⇒ Object
76 77 78 |
# File 'lib/rubyprot.rb', line 76 def aws_upload(location, name) return Rubyprot::Storage.aws_upload(location, name) end |
.configure {|_self| ... } ⇒ Object
Allows block configuration of Rubyprot attributes
Rubyprot.configure do |config|
config.dump_path = "my_folder/my_path"
config.amazon_bucket_name = "my_bucket"
config.amazon_access_key_id = "my_key"
config.amazon_secret_access_key = "my_access_key"
end
34 35 36 |
# File 'lib/rubyprot.rb', line 34 def configure yield self end |
.deserialize(name) ⇒ Object
Unmarshals named file from the folder specified by the dump_path
attribute. Returns the object.
>> Rubyprot.deserialize("Object")
=> #<Object:0x18a30d0>
54 55 56 |
# File 'lib/rubyprot.rb', line 54 def deserialize(name) return Rubyprot::Deserializer.deserialize(name) end |
.serialize(object) ⇒ Object
Marshals any object into a file named after the object class and stores the file in the folder specified by the dump_path
attribute. Returns the name of the file.
>> Rubyprot.serialize(object)
=> "Object"
44 45 46 |
# File 'lib/rubyprot.rb', line 44 def serialize(object) return Rubyprot::Serializer.serialize(object) end |