Class: PasteHub::EntryBase
- Inherits:
-
Object
- Object
- PasteHub::EntryBase
- Defined in:
- lib/pastehub/syncentry.rb
Direct Known Subclasses
Instance Method Summary collapse
- #decode_body(str) ⇒ Object
- #encode_body(bin) ⇒ Object
- #gen_header(create_date, bin, encoded) ⇒ Object
-
#initialize(hostname) ⇒ EntryBase
constructor
A new instance of EntryBase.
Constructor Details
Instance Method Details
#decode_body(str) ⇒ Object
50 51 52 |
# File 'lib/pastehub/syncentry.rb', line 50 def decode_body( str ) return Base64.decode64( str ) end |
#encode_body(bin) ⇒ Object
46 47 48 |
# File 'lib/pastehub/syncentry.rb', line 46 def encode_body( bin ) return Base64.strict_encode64( bin ).chomp end |
#gen_header(create_date, bin, encoded) ⇒ Object
54 55 56 57 58 59 60 61 62 |
# File 'lib/pastehub/syncentry.rb', line 54 def gen_header( create_date, bin, encoded ) h = Hash.new h[ :create_date ] = create_date h[ :create_unixtime ] = create_date.to_i h[ :hostname ] = @hostname h[ :bodySize ] = bin.size() h[ :encodedBodySize ] = encoded.size() return JSON.dump( h ) end |