salesflip-jobboersen_integration 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,8 +14,7 @@ module AccountExtras
14
14
  module InstanceMethods
15
15
  def create_in_tjb
16
16
  response = connection.post(
17
- "/administration/accounts.xml?auth_token=#{self.user.tjb_auth_token}",
18
- self.to_xml(:only => [:name]))
17
+ "/administration/accounts.xml?auth_token=#{self.user.tjb_auth_token}", tjb_xml)
19
18
  attributes = Hash.from_xml(response.body)['account']
20
19
  self.update_attributes :tjb_id => attributes['_id'], :do_not_update => true
21
20
  rescue
@@ -26,7 +25,7 @@ module AccountExtras
26
25
  if self.tjb_id
27
26
  connection.put(
28
27
  "/administration/accounts/#{self.tjb_id}.xml?auth_token=#{self.user.tjb_auth_token}",
29
- self.to_xml(:only => [:name]))
28
+ tjb_xml)
30
29
  else
31
30
  create_in_tjb
32
31
  end
@@ -41,5 +40,12 @@ module AccountExtras
41
40
  def prospect_or_customer?
42
41
  %w(Prospect Customer).include?(self.account_type)
43
42
  end
43
+
44
+ def tjb_xml
45
+ { :name => self.name, :street => self.billing_street, :locality => self.billing_locality,
46
+ :region => self.billing_region, :postal_code => self.billing_postal_code,
47
+ :country => self.billing_country, :account_type => self.account_type
48
+ }.to_xml(:root => 'account')
49
+ end
44
50
  end
45
51
  end
@@ -19,7 +19,7 @@ module JobboersenIntegration
19
19
  Salesflip::Plugin.register(:jobboersen_integration) do
20
20
  name 'JobBoersen Integration'
21
21
  author 'Matt Beedle'
22
- version '0.2.0'
22
+ version '0.2.1'
23
23
  description 'Everything to seemlessly integrate 1000jobboersen.de'
24
24
  end
25
25
 
@@ -3,6 +3,11 @@ class Account
3
3
 
4
4
  field :name
5
5
  field :account_type
6
+ field :billing_street
7
+ field :billing_locality
8
+ field :billing_region
9
+ field :billing_postal_code
10
+ field :billing_country
6
11
 
7
12
  referenced_in :user
8
13
  references_many :contacts
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: salesflip-jobboersen_integration
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 0
10
- version: 0.2.0
9
+ - 1
10
+ version: 0.2.1
11
11
  platform: ruby
12
12
  authors: []
13
13
 
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-30 00:00:00 +02:00
18
+ date: 2010-10-31 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies: []
21
21