infopark_crm_connector 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![Build Status](https://travis-ci.org/infopark/crm_connector.png?branch=master)](https://travis-ci.org/infopark/crm_connector)
4
4
 
5
- Infopark WebCRM Connector is the official Ruby SDK for [Infopark WebCRM](http://www.infopark.de/webcrm). It basically wraps the [WebCRM web services API](http://kb.infopark.de/crm-api) using [Active Resource](http://rubydoc.info/gems/activeresource/). Currently, Active Resource 3.0, 3.1 and 3.2 in combination with Ruby 1.8.7, 1.9.x and 2.0.0 are tested and supported.
5
+ Infopark WebCRM Connector is the official Ruby SDK for [Infopark WebCRM](http://www.infopark.de/webcrm). It basically wraps the [WebCRM web services API](http://kb.infopark.de/crm-api) using [Active Resource](http://rubydoc.info/gems/activeresource/). Currently, Active Resource 3.1 and 3.2 in combination with Ruby 1.8.7, 1.9.x and 2.0.0 are tested and supported.
6
6
 
7
7
  # Installation
8
8
 
@@ -102,6 +102,10 @@ Run tests with all supported versions of Active Resource:
102
102
 
103
103
  # Changelog
104
104
 
105
+ ## Version 1.1.0 - 2013-10-21
106
+ * Remove support for ActiveResource 3.0.
107
+ * Added `Attachment.upload_permission`, `Attachment.download_url` and the activity comment property `attachments`. See [API documentation](https://dev.infopark.net/26635f6d056215c9/attachments)
108
+
105
109
  ## Version 1.0.1 - 2013-03-20
106
110
  * Added continuous integration of travis-ci.org (see [travis-ci.org/infopark/crm_connector](https://travis-ci.org/infopark/crm_connector/))
107
111
  * Bugfix: Default attributes are inherited to subclasses (fixes [Issue #1](https://github.com/infopark/crm_connector/issues/1))
@@ -24,6 +24,7 @@ module Infopark; module Crm
24
24
  :appointment_dtstart_at => :time,
25
25
  :appointment_location => :string,
26
26
  :comment_notes => :string,
27
+ :comment_attachments => :array,
27
28
  :comment_published => :boolean,
28
29
  :contact_id => :string,
29
30
  :email_cc => :string,
@@ -59,5 +60,16 @@ module Infopark; module Crm
59
60
  Infopark::Crm::CustomType.find(kind) if kind
60
61
  end
61
62
 
63
+
64
+ class Comment < Core::Resource
65
+ self.schema = {
66
+ :contact_id => :string,
67
+ :notes => :string,
68
+ :attachments => :array,
69
+ :published => :boolean,
70
+ :updated_at => :time,
71
+ :updated_by => :string,
72
+ }
73
+ end
62
74
  end
63
75
  end; end
@@ -0,0 +1,37 @@
1
+ module Infopark
2
+ module Crm
3
+
4
+ class Attachment < Core::Resource
5
+
6
+ class Permission < Struct.new(:url, :fields, :upload_id)
7
+ end
8
+
9
+ ##
10
+ # Generates a temporary Amazon S3 URL for uploading a file to S3.
11
+ # @return [Permission]
12
+ # @webcrm_rest_url <code>GET /api/attachments/upload_permission</code>
13
+ # @see https://dev.infopark.net/26635f6d056215c9/attachments
14
+ # @example
15
+ # permission = Infopark::Crm::Attachment.upload_permission
16
+ def self.upload_permission
17
+ perm = get(:upload_permission)
18
+ Permission.new(perm["url"], perm["fields"], perm["upload_id"])
19
+ end
20
+
21
+ ##
22
+ # Generates a temporary download URL for the given attachment.
23
+ # @param attachment_id [String] An attachment ID taken from the attachments field inside the comments section of an activity.
24
+ # @param activity_id [String] The activity ID the attachment belongs to
25
+ # @return [String]
26
+ # @webcrm_rest_url <code>GET /api/attachments/download_url</code>
27
+ # @see https://dev.infopark.net/26635f6d056215c9/attachments
28
+ # @example
29
+ # url = Infopark::Crm::Attachment.download_url("c972c011b52ba671b68b16db961b82e7", "ff30a81adaaae7bd5a7066c350530c41")
30
+ def self.download_url(attachment_id, activity_id)
31
+ get(:download_url, :attachment_id => attachment_id, :activity_id => activity_id)
32
+ end
33
+
34
+ end
35
+
36
+ end
37
+ end
@@ -61,7 +61,6 @@ module Infopark; module Crm
61
61
  begin
62
62
  response = post(:authenticate, {}, format.encode({:login => login, :password => password}))
63
63
  result = format.decode(response.body)
64
- return find(result['id']) if result.kind_of? Hash # ActiveResource 3.0
65
64
  find(result)
66
65
  rescue ActiveResource::ResourceInvalid
67
66
  raise Errors::AuthenticationFailed
@@ -76,9 +75,7 @@ module Infopark; module Crm
76
75
  # @webcrm_rest_url <code>POST /api/contacts/password_set</code>
77
76
  def self.password_set(password, token)
78
77
  response = post(:password_set, {}, format.encode({:password => password, :token => token}))
79
- result = format.decode(response.body)
80
- return result['message'] if result.kind_of? Hash # ActiveResource 3.0
81
- result
78
+ format.decode(response.body)
82
79
  end
83
80
 
84
81
  ##
@@ -98,9 +95,7 @@ module Infopark; module Crm
98
95
  def password_request(options = {})
99
96
  params = options[:params] || {}
100
97
  response = post(:password_request, {}, self.class.format.encode(params))
101
- result = self.class.format.decode(response.body)
102
- return result.values.first if result.kind_of? Hash # ActiveResource 3.0
103
- result
98
+ self.class.format.decode(response.body)
104
99
  end
105
100
 
106
101
  # Returns the live_server_groups of this contact as defined by +Configuration.live_server_groups_callback+
@@ -20,7 +20,7 @@ module Infopark; module Crm; module Core
20
20
  prefix_options, query_options = split_options(options[:params])
21
21
  path = collection_path(prefix_options, query_options)
22
22
  response = prefix ? get(prefix, query_options) : connection.get(path, headers)
23
- response = format.decode(response.body) unless response.kind_of? Hash # = unless ActiveResource 3.0
23
+ response = format.decode(response.body) unless response.kind_of? Hash
24
24
  response = {'results' => response} if response.kind_of? Array # fighting ActiveResource 3.1 magic
25
25
  collection = instantiate_collection(response['results'] || [], prefix_options)
26
26
  result = Core::Enumerator.new(collection, response['continuation_handle'], response['total']) { |yielder|
@@ -31,7 +31,7 @@ module Infopark; module Crm; module Core
31
31
  query_options[:continuation_handle] = result.continuation_handle
32
32
  path = collection_path(prefix_options, query_options)
33
33
  response = prefix ? get(prefix, query_options) : connection.get(path, headers)
34
- response = format.decode(response.body) unless response.kind_of? Hash # = unless ActiveResource 3.0
34
+ response = format.decode(response.body) unless response.kind_of? Hash
35
35
  response = {'results' => response} if response.kind_of? Array # fighting ActiveResource 3.1 magic
36
36
  collection = instantiate_collection(response['results'] || [], prefix_options)
37
37
  result.update(collection, response['continuation_handle'], response['total'])
@@ -10,7 +10,6 @@ module Infopark; module Crm
10
10
  # @webcrm_rest_url <code>GET /api/templates</code>
11
11
  def self.templates
12
12
  response = base.connection.get(path, base.headers)
13
- return response['templates'] if response.kind_of? Hash # ActiveResource 3.0
14
13
  base.format.decode(response.body)
15
14
  end
16
15
 
metadata CHANGED
@@ -1,66 +1,61 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: infopark_crm_connector
3
- version: !ruby/object:Gem::Version
4
- hash: 21
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.0
5
5
  prerelease:
6
- segments:
7
- - 1
8
- - 0
9
- - 1
10
- version: 1.0.1
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Infopark AG
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2013-03-20 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
21
- version_requirements: &id001 !ruby/object:Gem::Requirement
22
- none: false
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- hash: 5
27
- segments:
28
- - 3
29
- version: "3"
30
- prerelease: false
31
- requirement: *id001
32
- type: :runtime
12
+ date: 2013-10-21 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
33
15
  name: activeresource
34
- - !ruby/object:Gem::Dependency
35
- version_requirements: &id002 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
36
17
  none: false
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- hash: 5
41
- segments:
42
- - 2
43
- - 3
44
- version: "2.3"
45
- prerelease: false
46
- requirement: *id002
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '3.1'
47
22
  type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '3.1'
30
+ - !ruby/object:Gem::Dependency
48
31
  name: backports
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '2.3'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '2.3'
49
46
  description: Infopark CRM Connector
50
47
  email: info@infopark.de
51
48
  executables: []
52
-
53
49
  extensions: []
54
-
55
50
  extra_rdoc_files: []
56
-
57
- files:
51
+ files:
58
52
  - .yardopts
59
53
  - LICENSE
60
54
  - README.markdown
61
55
  - lib/crm_connector.rb
62
56
  - lib/crm_connector/account.rb
63
57
  - lib/crm_connector/activity.rb
58
+ - lib/crm_connector/attachment.rb
64
59
  - lib/crm_connector/configuration.rb
65
60
  - lib/crm_connector/contact.rb
66
61
  - lib/crm_connector/core.rb
@@ -80,39 +75,31 @@ files:
80
75
  - lib/crm_connector/system.rb
81
76
  - lib/infopark_crm_connector.rb
82
77
  homepage: http://www.infopark.de
83
- licenses:
78
+ licenses:
84
79
  - LGPLv3
85
80
  post_install_message:
86
81
  rdoc_options: []
87
-
88
- require_paths:
82
+ require_paths:
89
83
  - lib
90
- required_ruby_version: !ruby/object:Gem::Requirement
84
+ required_ruby_version: !ruby/object:Gem::Requirement
91
85
  none: false
92
- requirements:
93
- - - ">="
94
- - !ruby/object:Gem::Version
95
- hash: 3
96
- segments:
86
+ requirements:
87
+ - - ! '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ segments:
97
91
  - 0
98
- version: "0"
99
- required_rubygems_version: !ruby/object:Gem::Requirement
92
+ hash: -4081557291616134614
93
+ required_rubygems_version: !ruby/object:Gem::Requirement
100
94
  none: false
101
- requirements:
102
- - - ">="
103
- - !ruby/object:Gem::Version
104
- hash: 17
105
- segments:
106
- - 1
107
- - 3
108
- - 5
95
+ requirements:
96
+ - - ! '>='
97
+ - !ruby/object:Gem::Version
109
98
  version: 1.3.5
110
99
  requirements: []
111
-
112
100
  rubyforge_project:
113
- rubygems_version: 1.8.15
101
+ rubygems_version: 1.8.23
114
102
  signing_key:
115
103
  specification_version: 3
116
104
  summary: Infopark CRM Connector
117
105
  test_files: []
118
-