towsta 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module Towsta
2
- VERSION = "0.2.5"
2
+ VERSION = "0.2.6"
3
3
  end
@@ -70,12 +70,14 @@ module Towsta
70
70
  export.delete :vertical
71
71
  id_aux = export.delete(:id)
72
72
  export = {:creator => creator, :vertical => self.class.to_s, :attributes => export, :id => id_aux}
73
- uri = URI.parse("http://manager.towsta.com/synchronizers/#{$towsta_secret}/insert.json")
74
- JSON.parse Net::HTTP.post_form(uri, {:code => export.to_json}).body.to_s, :symbolize_names => true
73
+ uri = URI.parse("http://manager.towsta.com/synchronizers/#{$towsta_secret}/import.json")
74
+ response = JSON.parse Net::HTTP.post_form(uri, {:code => export.to_json}).body.to_s, :symbolize_names => true
75
+ self.id = response[:id] if response[:status]
76
+ response
75
77
  end
76
78
 
77
79
  def self.create args
78
- self.new(args).save
80
+ self.new(args.merge(:id => nil)).save
79
81
  end
80
82
 
81
83
  def attributes
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 5
9
- version: 0.2.5
8
+ - 6
9
+ version: 0.2.6
10
10
  platform: ruby
11
11
  authors:
12
12
  - Mortaro