towsta 0.3.5 → 0.3.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,15 +1,17 @@
1
1
  require 'net/http'
2
+ require 'cgi'
2
3
  require 'json'
3
4
  require 'time'
4
5
 
5
6
  module Towsta
6
7
  class Synchronizer
7
8
 
8
- attr_accessor :secret, :path, :json
9
+ attr_accessor :secret, :path, :json, :params
9
10
 
10
11
  def initialize args
11
12
  @secret = args[:secret]
12
13
  @path = "#{args[:path]}.json"
14
+ @params = args[:params]
13
15
  synchronize ? backup : find_old
14
16
  puts just_do_it ? 'Ready to Towst!' : 'Unable to keep Towsting!'
15
17
  end
@@ -20,7 +22,9 @@ module Towsta
20
22
  return false
21
23
  end
22
24
  begin
23
- Net::HTTP.start("manager.towsta.com"){|http| @json = http.get("/synchronizers/#{@secret}/#{Time.now.to_i}/export.json").body}
25
+ uri = "/synchronizers/#{@secret}/#{Time.now.to_i}/export.json"
26
+ uri += "?query=#{CGI::escape(@params.to_json)}" if @params
27
+ Net::HTTP.start("manager.towsta.com"){|http| @json = http.get(uri).body}
24
28
  puts 'Synchronized with towsta...'
25
29
  if @json == " "
26
30
  puts 'Maybe your secret is wrong...'
@@ -1,3 +1,3 @@
1
1
  module Towsta
2
- VERSION = "0.3.5"
2
+ VERSION = "0.3.6"
3
3
  end
data/lib/towsta.rb CHANGED
@@ -5,6 +5,6 @@ require File.expand_path('../towsta/synchronizer', __FILE__)
5
5
  module Towsta
6
6
  end
7
7
 
8
- def sync_with_towsta
9
- Towsta::Synchronizer.new :secret => $towsta_secret, :path => $towsta_path
8
+ def sync_with_towsta params=nil
9
+ Towsta::Synchronizer.new :secret => $towsta_secret, :path => $towsta_path, :params => params
10
10
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 5
9
- version: 0.3.5
8
+ - 6
9
+ version: 0.3.6
10
10
  platform: ruby
11
11
  authors:
12
12
  - Mortaro
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-04-28 00:00:00 -03:00
17
+ date: 2011-04-29 00:00:00 -03:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency