active_campaign 0.1.14 → 0.1.15

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,21 +1,92 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActiveCampaign
2
4
  class Client
3
5
  module Campaigns
4
- GET_METHODS ||= %w(
5
- create delete_list delete list paginator report_bounce_list
6
- report_bounce_totals report_forward_list report_forward_totals
7
- report_link_list report_link_totals report_open_list report_open_totals
8
- report_totals report_unopen_list report_unsubscription_list
9
- report_unsubscription_totals send status
10
- ).freeze
11
- POST_METHODS ||= %w(create).freeze
12
-
13
- # TODO: Create proper methods with parameter validation and possible
14
- # naming fixes since this is one the worst APIs I have ever worked with.
15
- def self.included(base)
16
- base.class_exec do
17
- define_api_calls(:campaign, GET_METHODS, POST_METHODS)
18
- end
6
+ #
7
+ # POST methods
8
+ #
9
+ def campaign_edit(options = {})
10
+ post __method__, options
11
+ end
12
+
13
+ def campaign_create(options = {})
14
+ post __method__, options
15
+ end
16
+
17
+ #
18
+ # GET methods
19
+ #
20
+ def campaign_delete_list(options = {})
21
+ get __method__, options
22
+ end
23
+
24
+ def campaign_delete(options = {})
25
+ get __method__, options
26
+ end
27
+
28
+ def campaign_list(options = {})
29
+ get __method__, options
30
+ end
31
+
32
+ def campaign_paginator(options = {})
33
+ get __method__, options
34
+ end
35
+
36
+ def campaign_report_bounce_list(options = {})
37
+ get __method__, options
38
+ end
39
+
40
+ def campaign_report_bounce_totals(options = {})
41
+ get __method__, options
42
+ end
43
+
44
+ def campaign_report_forward_list(options = {})
45
+ get __method__, options
46
+ end
47
+
48
+ def campaign_report_forward_totals(options = {})
49
+ get __method__, options
50
+ end
51
+
52
+ def campaign_report_link_list(options = {})
53
+ get __method__, options
54
+ end
55
+
56
+ def campaign_report_link_totals(options = {})
57
+ get __method__, options
58
+ end
59
+
60
+ def campaign_report_open_list(options = {})
61
+ get __method__, options
62
+ end
63
+
64
+ def campaign_report_open_totals(options = {})
65
+ get __method__, options
66
+ end
67
+
68
+ def campaign_report_totals(options = {})
69
+ get __method__, options
70
+ end
71
+
72
+ def campaign_report_unopen_list(options = {})
73
+ get __method__, options
74
+ end
75
+
76
+ def campaign_report_unsubscription_list(options = {})
77
+ get __method__, options
78
+ end
79
+
80
+ def campaign_report_unsubscription_totals(options = {})
81
+ get __method__, options
82
+ end
83
+
84
+ def campaign_send(options = {})
85
+ get __method__, options
86
+ end
87
+
88
+ def campaign_status(options = {})
89
+ get __method__, options
19
90
  end
20
91
  end
21
92
  end
@@ -1,25 +1,97 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActiveCampaign
2
4
  class Client
3
5
  module Contacts
4
- GET_METHODS ||= %w(
5
- automation_list delete_list delete list paginator view view_email
6
- view_hash note_delete
7
- ).freeze
8
-
9
- POST_METHODS ||= %w(
10
- add edit sync tag_add tag_remove
11
- note_edit note_add
12
- ).freeze
13
-
14
- # TODO: Create proper methods with parameter validation and possible naming
15
- # fixes since this is one the worst APIs I have ever worked with.
16
- def self.included(base)
17
- base.class_exec do
18
- %w(contact subscriber).each do |name|
19
- define_api_calls(name, GET_METHODS, POST_METHODS)
20
- end
21
- end
6
+ #
7
+ # POST methods
8
+ #
9
+ def automation_contact_remove(options = {})
10
+ post __method__, options
11
+ end
12
+
13
+ def contact_add(options = {})
14
+ post __method__, options
15
+ end
16
+ alias subscriber_add contact_add
17
+
18
+ def contact_edit(options = {})
19
+ post __method__, options
20
+ end
21
+ alias subscriber_edit contact_edit
22
+
23
+ def contact_sync(options = {})
24
+ post __method__, options
25
+ end
26
+ alias subscriber_sync contact_sync
27
+
28
+ def contact_tag_add(options = {})
29
+ post __method__, options
30
+ end
31
+ alias subscriber_tag_add contact_tag_add
32
+
33
+ def contact_tag_remove(options = {})
34
+ post __method__, options
35
+ end
36
+ alias subscriber_tag_remove contact_tag_remove
37
+
38
+ def contact_note_edit(options = {})
39
+ post __method__, options
40
+ end
41
+ alias subscriber_note_edit contact_note_edit
42
+
43
+ def contact_note_add(options = {})
44
+ post __method__, options
45
+ end
46
+ alias subscriber_note_add contact_note_add
47
+
48
+ #
49
+ # GET methods
50
+ #
51
+ def contact_automation_list(options = {})
52
+ get __method__, options
53
+ end
54
+ alias subscriber_automation_list contact_automation_list
55
+
56
+ def contact_delete_list(options = {})
57
+ get __method__, options
58
+ end
59
+ alias subscriber_delete_list contact_delete_list
60
+
61
+ def contact_delete(options = {})
62
+ get __method__, options
63
+ end
64
+ alias subscriber_delete contact_delete
65
+
66
+ def contact_list(options = {})
67
+ get __method__, options
68
+ end
69
+ alias subscriber_list contact_list
70
+
71
+ def contact_paginator(options = {})
72
+ get __method__, options
73
+ end
74
+ alias subscriber_paginator contact_paginator
75
+
76
+ def contact_view(options = {})
77
+ get __method__, options
78
+ end
79
+ alias subscriber_view contact_view
80
+
81
+ def contact_view_email(options = {})
82
+ get __method__, options
83
+ end
84
+ alias subscriber_view_email contact_view_email
85
+
86
+ def contact_view_hash(options = {})
87
+ get __method__, options
88
+ end
89
+ alias subscriber_view_hash contact_view_hash
90
+
91
+ def contact_note_delete(options = {})
92
+ get __method__, options
22
93
  end
94
+ alias subscriber_note_delete contact_note_delete
23
95
  end
24
96
  end
25
97
  end
@@ -1,20 +1,86 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActiveCampaign
2
4
  class Client
3
5
  module Deals
4
- GET_METHODS ||= %w(get list pipeline_list stage_list).freeze
5
-
6
- POST_METHODS ||= %w(
7
- add delete edit note_add note_edit pipeline_add pipeline_delete
8
- pipeline_edit stage_add stage_delete stage_edit task_add task_edit
9
- tasktype_add tasktype_delete tasktype_edit
10
- ).freeze
11
-
12
- # TODO: Create proper methods with parameter validation and possible
13
- # naming fixes since this is one the worst APIs I have ever worked with.
14
- def self.included(base)
15
- base.class_exec do
16
- define_api_calls(:deal, GET_METHODS, POST_METHODS)
17
- end
6
+ def deal_get(options = {})
7
+ get __method__, options
8
+ end
9
+
10
+ def deal_list(options = {})
11
+ get __method__, options
12
+ end
13
+
14
+ def deal_pipeline_list(options = {})
15
+ get __method__, options
16
+ end
17
+
18
+ def deal_stage_list(options = {})
19
+ get __method__, options
20
+ end
21
+
22
+ def deal_add(options = {})
23
+ post __method__, options
24
+ end
25
+
26
+ def deal_delete(options = {})
27
+ post __method__, options
28
+ end
29
+
30
+ def deal_edit(options = {})
31
+ post __method__, options
32
+ end
33
+
34
+ def deal_note_add(options = {})
35
+ post __method__, options
36
+ end
37
+
38
+ def deal_note_edit(options = {})
39
+ post __method__, options
40
+ end
41
+
42
+ def deal_pipeline_add(options = {})
43
+ post __method__, options
44
+ end
45
+
46
+ def deal_pipeline_delete(options = {})
47
+ post __method__, options
48
+ end
49
+
50
+ def deal_pipeline_edit(options = {})
51
+ post __method__, options
52
+ end
53
+
54
+ def deal_stage_add(options = {})
55
+ post __method__, options
56
+ end
57
+
58
+ def deal_stage_delete(options = {})
59
+ post __method__, options
60
+ end
61
+
62
+ def deal_stage_edit(options = {})
63
+ post __method__, options
64
+ end
65
+
66
+ def deal_task_add(options = {})
67
+ post __method__, options
68
+ end
69
+
70
+ def deal_task_edit(options = {})
71
+ post __method__, options
72
+ end
73
+
74
+ def deal_tasktype_add(options = {})
75
+ post __method__, options
76
+ end
77
+
78
+ def deal_tasktype_delete(options = {})
79
+ post __method__, options
80
+ end
81
+
82
+ def deal_tasktype_edit(options = {})
83
+ post __method__, options
18
84
  end
19
85
  end
20
86
  end
@@ -1,14 +1,14 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActiveCampaign
2
4
  class Client
3
5
  module Forms
4
- GET_METHODS ||= %w(getforms html).freeze
6
+ def form_getforms(options = {})
7
+ get(__method__, options)
8
+ end
5
9
 
6
- # TODO: Create proper methods with parameter validation and possible
7
- # naming fixes since this is one the worst APIs I have ever worked with.
8
- def self.included(base)
9
- base.class_exec do
10
- define_api_calls(:form, GET_METHODS)
11
- end
10
+ def form_html(options = {})
11
+ get(__method__, options)
12
12
  end
13
13
  end
14
14
  end
@@ -1,18 +1,30 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActiveCampaign
2
4
  class Client
3
5
  module Groups
4
- GET_METHODS ||= %w(
5
- delete delete_list list view
6
- ).freeze
6
+ def group_delete(options = {})
7
+ get __method__, options
8
+ end
7
9
 
8
- POST_METHODS ||= %w(add edit).freeze
10
+ def group_delete_list(options = {})
11
+ get __method__, options
12
+ end
13
+
14
+ def group_list(options = {})
15
+ get __method__, options
16
+ end
17
+
18
+ def group_view(options = {})
19
+ get __method__, options
20
+ end
21
+
22
+ def group_add(options = {})
23
+ post __method__, options
24
+ end
9
25
 
10
- # TODO: Create proper methods with parameter validation and possible
11
- # naming fixes since this is one the worst APIs I have ever worked with.
12
- def self.included(base)
13
- base.class_exec do
14
- define_api_calls(:group, GET_METHODS, POST_METHODS)
15
- end
26
+ def group_edit(options = {})
27
+ post __method__, options
16
28
  end
17
29
  end
18
30
  end
@@ -1,19 +1,58 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActiveCampaign
2
4
  class Client
3
5
  module Lists
4
- GET_METHODS ||= %w(
5
- delete_list delete field_delete
6
- field_view list paginator view
7
- ).freeze
8
- POST_METHODS ||= %w(
9
- add edit field_add field_edit
10
- ).freeze
11
- DELETE_METHODS ||= [].freeze
12
-
13
- def self.included(base)
14
- base.class_exec do
15
- define_api_calls(:list, GET_METHODS, POST_METHODS, DELETE_METHODS)
16
- end
6
+ #
7
+ # POST methods
8
+ #
9
+
10
+ def list_add(options = {})
11
+ post __method__, options
12
+ end
13
+
14
+ def list_edit(options = {})
15
+ post __method__, options
16
+ end
17
+
18
+ def list_field_add(options = {})
19
+ post __method__, options
20
+ end
21
+
22
+ def list_field_edit(options = {})
23
+ post __method__, options
24
+ end
25
+
26
+ #
27
+ # GET methods
28
+ #
29
+
30
+ def list_delete_list(options = {})
31
+ get __method__, options
32
+ end
33
+
34
+ def list_delete(options = {})
35
+ get __method__, options
36
+ end
37
+
38
+ def list_field_delete(options = {})
39
+ get __method__, options
40
+ end
41
+
42
+ def list_field_view(options = {})
43
+ get __method__, options
44
+ end
45
+
46
+ def list_list(options = {})
47
+ get __method__, options
48
+ end
49
+
50
+ def list_paginator(options = {})
51
+ get __method__, options
52
+ end
53
+
54
+ def list_view(options = {})
55
+ get __method__, options
17
56
  end
18
57
  end
19
58
  end