infopark_webcrm_sdk 2.1.0 → 2.3.2

Sign up to get free protection for your applications and to get access to all the features.
data/lib/crm.rb CHANGED
@@ -4,7 +4,7 @@ require 'crm/errors'
4
4
 
5
5
  # @api public
6
6
  module Crm
7
- # Configures the Infopark WebCRM SDK.
7
+ # Configures the JustRelate WebCRM SDK.
8
8
  # The config keys +tenant+, +login+ and +api_key+ must be provided.
9
9
  # @example
10
10
  # Crm.configure do |config|
data/lib/crm/account.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Crm
2
- # An Infopark WebCRM account is an organizational entity such as a company.
2
+ # A JustRelate WebCRM account is an organizational entity such as a company.
3
3
  # @api public
4
4
  class Account < Core::BasicResource
5
5
  include Core::Mixins::Findable
data/lib/crm/activity.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Crm
2
- # An Infopark WebCRM activity is a record of an action or a sequence of actions,
2
+ # A JustRelate WebCRM activity is a record of an action or a sequence of actions,
3
3
  # for example a support case.
4
4
  # It can be associated with an {Account account} or a {Contact contact}.
5
5
  #
@@ -1,5 +1,5 @@
1
1
  module Crm
2
- # An Infopark WebCRM collection is a saved search. To execute such a saved search, call {#compute}.
2
+ # A JustRelate WebCRM collection is a saved search. To execute such a saved search, call {#compute}.
3
3
  # The results are persisted and can be accessed by means of {#output_items}.
4
4
  # Output items can be {Account accounts}, {Contact contacts}, {Activity activities},
5
5
  # and {Event events}.
data/lib/crm/contact.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Crm
2
- # An Infopark WebCRM contact represents contact information about a person.
2
+ # A JustRelate WebCRM contact represents contact information about a person.
3
3
  # It can be associated with an {Account account}.
4
4
  # @api public
5
5
  class Contact < Core::BasicResource
@@ -24,15 +24,15 @@ module Crm; module Core
24
24
  # The format of +comment_attachments+ is
25
25
  # <tt>["upload_id/filename.ext", ...]</tt>,
26
26
  # e.g. <tt>["e13f0d960feeb2b2903bd/screenshot.jpg"]</tt>.
27
- # Infopark WebCRM in turn translates these upload IDs to attachment IDs.
27
+ # JustRelate WebCRM in turn translates these upload IDs to attachment IDs.
28
28
  # Syntactically they look the same. Upload IDs, however, are only temporary,
29
29
  # whereas attachment IDs are permanent. If the client appended a filename to the upload ID,
30
30
  # the attachment ID will contain this filename, too. Otherwise, the attachment ID ends
31
- # with <tt>"/file"</tt>. Please note that Infopark WebCRM replaces filename characters other
31
+ # with <tt>"/file"</tt>. Please note that JustRelate WebCRM replaces filename characters other
32
32
  # than <tt>a-zA-Z0-9.+-</tt> with a dash. Multiple dashes will be joined into a single dash.
33
33
  # 4. Later, when downloading the attachment, pass the attachment ID to
34
34
  # {Crm::Core::AttachmentStore.generate_download_url}.
35
- # Infopark WebCRM returns a signed AWS S3 URL that remains valid for 5 minutes.
35
+ # JustRelate WebCRM returns a signed AWS S3 URL that remains valid for 5 minutes.
36
36
  # @api public
37
37
  class AttachmentStore
38
38
  # +Permission+ holds all the pieces of information required to upload an {AttachmentStore attachment}.
@@ -1,5 +1,5 @@
1
1
  module Crm; module Core
2
- # +BasicResource+ is the base class of all Infopark WebCRM SDK resources.
2
+ # +BasicResource+ is the base class of all JustRelate WebCRM SDK resources.
3
3
  # @api public
4
4
  class BasicResource
5
5
  include Mixins::AttributeProvider
@@ -41,7 +41,7 @@ module Crm; module Core
41
41
  end
42
42
 
43
43
  # The {http://www.ruby-doc.org/stdlib/libdoc/logger/rdoc/Logger.html logger} of the
44
- # Infopark WebCRM SDK. It logs request URLs according to the +:info+ level.
44
+ # JustRelate WebCRM SDK. It logs request URLs according to the +:info+ level.
45
45
  # Additionally, it logs request and response payloads according to the +:debug+ level.
46
46
  # Password fields are filtered out.
47
47
  # In a Rails environment, the logger defaults to +Rails.logger+. Otherwise, no logger is set.
@@ -1,4 +1,4 @@
1
- require 'action_dispatch'
1
+ require "active_support/parameter_filter"
2
2
 
3
3
  module Crm; module Core
4
4
  class LogSubscriber < ActiveSupport::LogSubscriber
@@ -10,7 +10,7 @@ module Crm; module Core
10
10
  info { "#{event.payload[:method].to_s.upcase} #{event.payload[:resource_path]}" }
11
11
  request_payload = event.payload[:request_payload]
12
12
  if request_payload.present?
13
- debug { " request body: #{parameter_filter.filter(request_payload)}" }
13
+ debug { " request body: #{parameter_filter.filter({data: request_payload})[:data]}" }
14
14
  end
15
15
  end
16
16
 
@@ -21,7 +21,7 @@ module Crm; module Core
21
21
  }
22
22
  debug {
23
23
  response_payload = MultiJson.load(r.body)
24
- " response body: #{parameter_filter.filter(response_payload)}"
24
+ " response body: #{parameter_filter.filter({data: response_payload})[:data]}"
25
25
  }
26
26
  end
27
27
 
@@ -35,7 +35,7 @@ module Crm; module Core
35
35
  private
36
36
 
37
37
  def parameter_filter
38
- @parameter_filter ||= ::ActionDispatch::Http::ParameterFilter.new(['password'])
38
+ @parameter_filter ||= ::ActiveSupport::ParameterFilter.new(['password'])
39
39
  end
40
40
  end
41
41
  end; end
@@ -2,7 +2,7 @@ require "active_support/concern"
2
2
 
3
3
  module Crm; module Core; module Mixins
4
4
  # +Modifiable+ is a collection of methods that are used to {ClassMethods#create .create},
5
- # {#update} and {#delete} an Infopark WebCRM item.
5
+ # {#update} and {#delete} a JustRelate WebCRM item.
6
6
  # @api public
7
7
  module Modifiable
8
8
  extend ActiveSupport::Concern
data/lib/crm/errors.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module Crm
2
2
  # @api public
3
3
  module Errors
4
- # +BaseError+ is the superclass of all Infopark WebCRM SDK errors.
4
+ # +BaseError+ is the superclass of all JustRelate WebCRM SDK errors.
5
5
  # @api public
6
6
  class BaseError < StandardError
7
7
  end
data/lib/crm/event.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Crm
2
- # An Infopark WebCRM event contains all data associated with an event such
2
+ # A JustRelate WebCRM event contains all data associated with an event such
3
3
  # as a conference or a trade show. An event has participants ({EventContact}).
4
4
  # @api public
5
5
  class Event < Core::BasicResource
@@ -1,5 +1,5 @@
1
1
  module Crm
2
- # An Infopark WebCRM event contact is a participant or a potential participant of an {Event}.
2
+ # A JustRelate WebCRM event contact is a participant or a potential participant of an {Event}.
3
3
  # @api public
4
4
  class EventContact < Core::BasicResource
5
5
  include Core::Mixins::Findable
data/lib/crm/mailing.rb CHANGED
@@ -1,10 +1,10 @@
1
1
  module Crm
2
- # The purpose of an Infopark WebCRM mailing is to send an email, e.g. a newsletter,
2
+ # The purpose of a JustRelate WebCRM mailing is to send an email, e.g. a newsletter,
3
3
  # to several recipients.
4
4
  # The emails will be sent to the members of the contact collection associated with the mailing
5
5
  # (+mailing.collection_id+).
6
6
  #
7
- # Infopark WebCRM uses the {http://liquidmarkup.org/ Liquid template engine} for evaluating
7
+ # JustRelate WebCRM uses the {http://liquidmarkup.org/ Liquid template engine} for evaluating
8
8
  # mailing content.
9
9
  # @api public
10
10
  class Mailing < Core::BasicResource
@@ -19,6 +19,16 @@ module Crm
19
19
  # @!parse extend Core::Mixins::Modifiable::ClassMethods
20
20
  # @!parse extend Core::Mixins::Searchable::ClassMethods
21
21
 
22
+ # Clones a mailing.
23
+ # @example
24
+ # mailing.clone
25
+ # # => Crm::Mailing
26
+ # @return [BasicResource] the cloned mailing.
27
+ # @api public
28
+ def clone
29
+ self.class.new(Core::RestApi.instance.post("#{path}/clone", {}))
30
+ end
31
+
22
32
  # Renders a preview of the email for the given contact.
23
33
  # @example
24
34
  # mailing.html_body
@@ -0,0 +1,95 @@
1
+ module Crm
2
+ # MailingDelivery represents a mailing delivery.
3
+ # @api public
4
+ class MailingDelivery
5
+ include Core::Mixins::Inspectable
6
+ include Core::Mixins::AttributeProvider
7
+
8
+ inspectable :mailing_id, :id
9
+
10
+ def self.all(mailing_id, since: nil)
11
+ path = ['mailings', mailing_id, 'mailing_deliveries'].compact.join('/')
12
+ params = {}
13
+ case since
14
+ when Time
15
+ params[:since] = since.utc.xmlschema
16
+ when String
17
+ params[:since] = since
18
+ when nil
19
+ # ignore
20
+ else
21
+ raise "unknown class of since param: #{since.class}"
22
+ end
23
+ Core::RestApi.instance.get(path, params).map {|attrs| new({'mailing_id' => mailing_id}.merge(attrs))}
24
+ end
25
+
26
+ # Creates or updates a mailing delivery.
27
+ # @example
28
+ # Crm::MailingDelivery.create(mailing.id, "abc@example.com", {
29
+ # custom_data: {
30
+ # salutation: 'Hello You',
31
+ # },
32
+ # })
33
+ # @param mailing_id [String] the mailing ID
34
+ # @param id [String] the email address
35
+ # @param attributes [Hash{String, Symbol => String}] the new attributes.
36
+ # @return [self] the created or updated mailing delivery.
37
+ # @api public
38
+ def self.create(mailing_id, id, attributes = {})
39
+ new({'mailing_id' => mailing_id, 'id' => id}).update(attributes)
40
+ end
41
+
42
+ # Returns the requested mailing delivery.
43
+ # @example
44
+ # d = Crm::MailingDelivery.find(mailing.id, "abc@example.com")
45
+ # # => #<Crm::MailingDelivery mailing_id="94933088cec0014575ff920ee9830cfb", id="abc@example.com">
46
+ # @param mailing_id [String] the mailing ID
47
+ # @param id [String] the email address
48
+ # @return [MailingDelivery]
49
+ # @api public
50
+ def self.find(mailing_id, id)
51
+ raise Crm::Errors::ResourceNotFound.new("Items could not be found.", [mailing_id]) if mailing_id.blank?
52
+ raise Crm::Errors::ResourceNotFound.new("Items could not be found.", [id]) if id.blank?
53
+
54
+ new({'mailing_id' => mailing_id, 'id' => id}).reload
55
+ end
56
+
57
+ # Deletes the mailing delivery.
58
+ #
59
+ # @raise [Errors::ResourceConflict] if the item has been changed concurrently.
60
+ # {Core::BasicResource#reload Reload} it, review the changes and retry.
61
+ # @api public
62
+ def delete
63
+ Core::RestApi.instance.delete(path, nil, if_match_header)
64
+ nil
65
+ end
66
+
67
+ # Updates the attributes of this mailing delivery.
68
+ # @example
69
+ # mailing_delivery.update({
70
+ # custom_data: {
71
+ # salutation: 'Hello You',
72
+ # },
73
+ # })
74
+ # @param attributes [Hash{String, Symbol => String}] the new attributes.
75
+ # @return [self] the updated mailing delivery.
76
+ # @api public
77
+ def update(attributes = {})
78
+ load_attributes(Core::RestApi.instance.put(path, attributes, if_match_header))
79
+ end
80
+
81
+ def reload
82
+ load_attributes(Core::RestApi.instance.get(path))
83
+ end
84
+
85
+ private
86
+
87
+ def path
88
+ ['mailings', mailing_id, 'mailing_deliveries', id].compact.join('/')
89
+ end
90
+
91
+ def if_match_header
92
+ {'If-Match' => self['version']}
93
+ end
94
+ end
95
+ end
@@ -1,9 +1,9 @@
1
1
  module Crm
2
- # +TemplateSet+ represents the Infopark WebCRM template set singleton.
2
+ # +TemplateSet+ represents the JustRelate WebCRM template set singleton.
3
3
  # The templates of the {.singleton template set singleton} can be used to render customized text,
4
4
  # e.g. a mailing greeting or a password request email body (+password_request_email_body+).
5
5
  #
6
- # Infopark WebCRM uses the {http://liquidmarkup.org/ Liquid template engine} for evaluating
6
+ # JustRelate WebCRM uses the {http://liquidmarkup.org/ Liquid template engine} for evaluating
7
7
  # the templates.
8
8
  # @api public
9
9
  class TemplateSet < Core::BasicResource
data/lib/crm/type.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Crm
2
- # An Infopark WebCRM type defines a set of attributes associated with every instance of the type.
2
+ # A JustRelate WebCRM type defines a set of attributes associated with every instance of the type.
3
3
  # @example Listing all attributes of a type
4
4
  # account_type = Crm::Type.find('account')
5
5
  # # => Crm::Type
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: infopark_webcrm_sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.3.2
5
5
  platform: ruby
6
6
  authors:
7
- - Infopark AG
7
+ - JustRelate Group GmbH
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-20 00:00:00.000000000 Z
11
+ date: 2021-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack
@@ -80,11 +80,11 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '2.0'
83
- description: "\n Infopark WebCRM is a professional cloud CRM built for Ruby.\n
84
- \ For more information about Infopark WebCRM, please visit https://infopark.com/.\n
85
- \ For more information about the Infopark WebCRM SDK for Ruby, please visit\n
83
+ description: "\n JustRelate WebCRM is a professional cloud CRM built for Ruby.\n
84
+ \ For more information about JustRelate WebCRM, please visit https://justrelate.com/.\n
85
+ \ For more information about the JustRelate WebCRM SDK for Ruby, please visit\n
86
86
  \ http://www.rubydoc.info/gems/infopark_webcrm_sdk\n "
87
- email: info@infopark.de
87
+ email: info@justrelate.com
88
88
  executables: []
89
89
  extensions: []
90
90
  extra_rdoc_files: []
@@ -119,6 +119,7 @@ files:
119
119
  - lib/crm/event.rb
120
120
  - lib/crm/event_contact.rb
121
121
  - lib/crm/mailing.rb
122
+ - lib/crm/mailing_delivery.rb
122
123
  - lib/crm/mailing_recipient.rb
123
124
  - lib/crm/template_set.rb
124
125
  - lib/crm/type.rb
@@ -142,9 +143,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
143
  - !ruby/object:Gem::Version
143
144
  version: '0'
144
145
  requirements: []
145
- rubyforge_project:
146
- rubygems_version: 2.6.14.1
146
+ rubygems_version: 3.0.3
147
147
  signing_key:
148
148
  specification_version: 4
149
- summary: Infopark WebCRM SDK
149
+ summary: JustRelate WebCRM SDK
150
150
  test_files: []