active_campaign_wrapper 0.4.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a735bcf1cf52db420446e13c246621ba8eb009a5d776e1889c68355bd11e811f
4
- data.tar.gz: b154ef14ee4a7e9ff35f68cd65bb198e335b3de3071cf331be79a200fa14035c
3
+ metadata.gz: 1bf2404f9255f86ad346dc8c554e4ec9a095467297bf6205743b478197662067
4
+ data.tar.gz: f58700f28d9bd18f8de3f90a8934647dbe76bfa29b6fcd2e19d3dd176274c4cc
5
5
  SHA512:
6
- metadata.gz: 3eea2118267ad4e4be0a012f6e04f8a10c66aa7b82045bd828ac984a073afc5decc1c59252483239e517a6e86ac74a2264482434415ffb3d976536eecac0cc65
7
- data.tar.gz: c61f5a8c3f8fd38d79dd556a8bf8bacd80ffcf773c5e3868eb5586472469c688eb4d2902603c7734e8ebcaa1a1b70eee57bcffa1559da4578c917d0cae384dae
6
+ metadata.gz: b0d2aa5d73d5cb165296bfe614869956b9e427a46e727392e46db2b65b22c2d8515dce20cee1ba39eeebe18f2f527c677db9399401fa4e372ca7678d79a9e3f6
7
+ data.tar.gz: 9ee24c9f72a63818e978ea32dea09cf9c9ebda53802032df744cd5ce3b260d6d58d7f0a0dc7196fcfb9a1b7d96d620fc586498e3abd64b104dda37efd1d139e1
data/README.md CHANGED
@@ -43,6 +43,7 @@ Or install it yourself as:
43
43
  * [Users](#users)
44
44
  * [Groups](#groups)
45
45
  * [Templates](#templates)
46
+ * [Task Types](#task-types)
46
47
 
47
48
  <a name="initialize"/>
48
49
 
@@ -741,7 +742,7 @@ client.templates.find(template_id)
741
742
  #### Delete a template
742
743
 
743
744
  ```ruby
744
- client.templates.delete(templates_id)
745
+ client.templates.delete(template_id)
745
746
  ```
746
747
 
747
748
  #### List all templates
@@ -750,6 +751,51 @@ client.templates.delete(templates_id)
750
751
  client.templates.all
751
752
  ```
752
753
 
754
+ <a name="task-types"/>
755
+
756
+ ### Task Types - [Api Reference](https://developers.activecampaign.com/reference#deal-task-types)
757
+
758
+ #### Create a task type
759
+
760
+ ```ruby
761
+ client.task_types.create({
762
+ title: 'Call'
763
+ })
764
+ ```
765
+ **BODY PARAMS**
766
+ - title* (string): Deal task type's title. The title should be unique among deal task types.
767
+
768
+ #### Retrieve a task type
769
+
770
+ ```ruby
771
+ client.task_types.find(task_type_id)
772
+ ```
773
+ #### Update a task type
774
+
775
+ ```ruby
776
+ client.task_types.update(task_type_id, {
777
+ title: 'New super cool title'
778
+ })
779
+ ```
780
+
781
+ #### Delete a task type
782
+
783
+ ```ruby
784
+ client.task_types.delete(task_type_id)
785
+ ```
786
+
787
+ #### List all task types
788
+
789
+ ```ruby
790
+ client.task_types.all
791
+ ```
792
+
793
+ #### Move tasks to another task type
794
+
795
+ ```ruby
796
+ client.task_types.move_tasks(from_task_type_id, to_task_type_id)
797
+ ```
798
+
753
799
  ## Contributing
754
800
 
755
801
  Bug reports and pull requests are welcome on GitHub at https://github.com/anmol-yousaf/active_campaign_wrapper. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/anmol-yousaf/active_campaign_wrapper/blob/master/CODE_OF_CONDUCT.md).
@@ -16,6 +16,7 @@ require 'active_campaign_wrapper/core/group_gateway'
16
16
  require 'active_campaign_wrapper/core/list_group_gateway'
17
17
  require 'active_campaign_wrapper/core/user_gateway'
18
18
  require 'active_campaign_wrapper/core/template_gateway'
19
+ require 'active_campaign_wrapper/core/task_type_gateway'
19
20
 
20
21
  require 'active_campaign_wrapper/api/contact/arguments'
21
22
  require 'active_campaign_wrapper/api/list/arguments'
@@ -90,5 +91,9 @@ module ActiveCampaignWrapper
90
91
  def templates
91
92
  @templates ||= TemplateGateway.new(self)
92
93
  end
94
+
95
+ def task_types
96
+ @task_types ||= TaskTypeGateway.new(self)
97
+ end
93
98
  end
94
99
  end
@@ -16,7 +16,7 @@ module ActiveCampaignWrapper
16
16
  @api_token = api_token.presence || ActiveCampaignWrapper.api_token
17
17
 
18
18
  self.class.base_uri "#{@endpoint_url}/api/#{ActiveCampaignWrapper::API_VERSION}"
19
- self.class.default_options.merge! headers: { api_token: @api_token }
19
+ self.class.default_options.merge! headers: { 'Api-Token' => @api_token }
20
20
  end
21
21
 
22
22
  def post(*args)
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActiveCampaignWrapper
4
+ module Core
5
+ class TaskTypeGateway
6
+ def initialize(client)
7
+ @client = client
8
+ @config = client.config
9
+ end
10
+
11
+ def all(**params)
12
+ @config.get('/dealTasktypes', query: params)
13
+ end
14
+
15
+ def create(params)
16
+ params = { deal_tasktype: params }
17
+ @config.post(
18
+ '/dealTasktypes',
19
+ body: ActiveCampaignWrapper::Helpers.normalize_body(params)
20
+ )
21
+ end
22
+
23
+ def delete(task_type_id)
24
+ @config.delete("/dealTasktypes/#{task_type_id}")
25
+ end
26
+
27
+ def update(task_type_id, params)
28
+ params = { deal_tasktype: params }
29
+ @config.put(
30
+ "/dealTasktypes/#{task_type_id}", body:
31
+ ActiveCampaignWrapper::Helpers.normalize_body(params)
32
+ )
33
+ end
34
+
35
+ def find(task_type_id)
36
+ @config.get("/dealTasktypes/#{task_type_id}")
37
+ end
38
+
39
+ def move_tasks(from_task_type_id, to_task_type_id)
40
+ params = { deal_task: { deal_tasktype: to_task_type_id } }
41
+ @config.put(
42
+ "/dealTasktypes/#{from_task_type_id}/dealTasks",
43
+ body: ActiveCampaignWrapper::Helpers.normalize_body(params)
44
+ )
45
+ end
46
+ end
47
+ end
48
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveCampaignWrapper
4
- VERSION = '0.4.0'
4
+ VERSION = '0.5.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_campaign_wrapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anmol Yousaf
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-03-31 00:00:00.000000000 Z
11
+ date: 2021-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -271,6 +271,7 @@ files:
271
271
  - lib/active_campaign_wrapper/core/list_gateway.rb
272
272
  - lib/active_campaign_wrapper/core/list_group_gateway.rb
273
273
  - lib/active_campaign_wrapper/core/tag_gateway.rb
274
+ - lib/active_campaign_wrapper/core/task_type_gateway.rb
274
275
  - lib/active_campaign_wrapper/core/template_gateway.rb
275
276
  - lib/active_campaign_wrapper/core/user_gateway.rb
276
277
  - lib/active_campaign_wrapper/helpers.rb