ractive_campaign 0.1.1 → 0.1.5
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 +4 -4
- data/CHANGELOG.md +38 -1
- data/Gemfile.lock +7 -4
- data/README.md +12 -6
- data/lib/active_campaign/api_http.rb +5 -5
- data/lib/active_campaign/models/account_contact.rb +9 -0
- data/lib/active_campaign/models/campaign.rb +7 -0
- data/lib/active_campaign/models/contact.rb +13 -3
- data/lib/active_campaign/models/contact_automation.rb +7 -0
- data/lib/active_campaign/models/contact_deal.rb +7 -0
- data/lib/active_campaign/models/contact_tag.rb +2 -2
- data/lib/active_campaign/models/custom_deal_field.rb +21 -0
- data/lib/active_campaign/models/custom_deal_field_value.rb +20 -0
- data/lib/active_campaign/models/deal.rb +17 -0
- data/lib/active_campaign/models/email_activity.rb +7 -0
- data/lib/active_campaign/models/field.rb +13 -0
- data/lib/active_campaign/models/field_value.rb +9 -0
- data/lib/active_campaign/models/list.rb +2 -38
- data/lib/active_campaign/models/model.rb +1 -1
- data/lib/active_campaign/models/pipeline.rb +18 -0
- data/lib/active_campaign/models/stage.rb +22 -0
- data/lib/active_campaign/models/tag.rb +6 -0
- data/lib/active_campaign/models/task.rb +23 -0
- data/lib/active_campaign/models/task_outcome.rb +7 -0
- data/lib/active_campaign/models/task_type.rb +13 -0
- data/lib/active_campaign/models/user.rb +15 -0
- data/lib/active_campaign/version.rb +1 -1
- data/lib/ractive_campaign.rb +3 -0
- metadata +28 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0f3b24a31bfe00c8c7bbe97b2a480cb6c7d5ea0838e01b7beb79311e3ee5d43
|
4
|
+
data.tar.gz: 9ca59df1246b16a23d7640ce60552328a9e0802f438e645348e91e728cf9db66
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95566c3ad4cf971380b2486058f315c16cb0f8ad5263e145167d40d96ee30d22c85079a5d4ee8868b1effc8a37f7d32d2e1d30fc215f4db555bb6544f309b589
|
7
|
+
data.tar.gz: 0ea82c9eb5b94efb4e881b10b603e8c035f226630f67115f173c28dcdae4b202e011710bedf11e73df880c9118c67778a56c7efdab97619de6b18eb09335bcde
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,42 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
-
## [0.1.
|
3
|
+
## [0.1.5] - 2021-11-19
|
4
|
+
### Changed
|
5
|
+
|
6
|
+
- when adding a tag to a contact, create it if it doesn't exist
|
7
|
+
|
8
|
+
## [0.1.4] - 2021-11-19
|
9
|
+
### Changed
|
10
|
+
|
11
|
+
- loading endpoint result into the correct model class
|
12
|
+
- README section on `install and require`
|
13
|
+
|
14
|
+
## [0.1.3] - 2021-11-18
|
15
|
+
### Added
|
16
|
+
|
17
|
+
- account contact
|
18
|
+
- campaign
|
19
|
+
- contact automatin
|
20
|
+
- etc
|
21
|
+
|
22
|
+
### Changed
|
23
|
+
|
24
|
+
- attrs config
|
25
|
+
- README config info
|
26
|
+
|
27
|
+
## [0.1.2] - 2021-11-17
|
28
|
+
### Added
|
29
|
+
|
30
|
+
- list
|
31
|
+
- etc
|
32
|
+
|
33
|
+
## [0.1.0] - 2021-11-13
|
34
|
+
### Added
|
35
|
+
|
36
|
+
- contact
|
37
|
+
- tags
|
38
|
+
- etc
|
39
|
+
|
40
|
+
## [0.0.1] - 2021-11-10
|
4
41
|
|
5
42
|
- Initial release
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ractive_campaign (0.1.
|
4
|
+
ractive_campaign (0.1.5)
|
5
5
|
activemodel (~> 6.1.4)
|
6
|
-
dry-configurable (~> 0.
|
6
|
+
dry-configurable (~> 0.12.1)
|
7
7
|
faraday (~> 1.8.0)
|
8
8
|
faraday_middleware (~> 1.2.0)
|
9
9
|
|
@@ -28,7 +28,10 @@ GEM
|
|
28
28
|
rexml
|
29
29
|
diff-lcs (1.4.4)
|
30
30
|
dotenv (2.7.6)
|
31
|
-
dry-configurable (0.
|
31
|
+
dry-configurable (0.12.1)
|
32
|
+
concurrent-ruby (~> 1.0)
|
33
|
+
dry-core (~> 0.5, >= 0.5.0)
|
34
|
+
dry-core (0.7.1)
|
32
35
|
concurrent-ruby (~> 1.0)
|
33
36
|
faraday (1.8.0)
|
34
37
|
faraday-em_http (~> 1.0)
|
@@ -88,7 +91,7 @@ GEM
|
|
88
91
|
diff-lcs (>= 1.2.0, < 2.0)
|
89
92
|
rspec-support (~> 3.10.0)
|
90
93
|
rspec-support (3.10.3)
|
91
|
-
rubocop (1.
|
94
|
+
rubocop (1.23.0)
|
92
95
|
parallel (~> 1.10)
|
93
96
|
parser (>= 3.0.0.0)
|
94
97
|
rainbow (>= 2.2.2, < 4.0)
|
data/README.md
CHANGED
@@ -1,13 +1,15 @@
|
|
1
|
+
[](https://badge.fury.io/rb/ractive_campaign) [](https://codeclimate.com/github/wedsonlima/ractive_campaign/maintainability) [](https://codeclimate.com/github/wedsonlima/ractive_campaign/test_coverage)
|
2
|
+
|
1
3
|
# RactiveCampaign
|
2
4
|
|
3
|
-
|
5
|
+
Ruby API wrapper for ActiveCampaign API v3
|
4
6
|
|
5
7
|
## Installation
|
6
8
|
|
7
9
|
Add this line to your application's Gemfile:
|
8
10
|
|
9
11
|
```ruby
|
10
|
-
gem
|
12
|
+
gem "ractive_campaign"
|
11
13
|
```
|
12
14
|
|
13
15
|
And then execute:
|
@@ -37,11 +39,15 @@ end
|
|
37
39
|
|
38
40
|
```ruby
|
39
41
|
# new
|
40
|
-
harry = ActiveCampaign::Contact.new firstName: "Harry",
|
42
|
+
harry = ActiveCampaign::Contact.new firstName: "Harry",
|
43
|
+
lastName: "Potter",
|
44
|
+
email: "potter.hurray@hogwash.com"
|
41
45
|
harry.save
|
42
46
|
|
43
47
|
# create
|
44
|
-
hermione = ActiveCampaign::Contact.new firstName: "Hermione",
|
48
|
+
hermione = ActiveCampaign::Contact.new firstName: "Hermione",
|
49
|
+
lastName: "Granger",
|
50
|
+
email: "mione@drtooth.com"
|
45
51
|
|
46
52
|
# update
|
47
53
|
ron = ActiveCampaign::Contact.create email: "ron1988@hogwash.com", lastName: "Weasley"
|
@@ -52,7 +58,7 @@ ron.save
|
|
52
58
|
#### Tag
|
53
59
|
|
54
60
|
```ruby
|
55
|
-
ActiveCampaign::
|
61
|
+
ActiveCampaign::Tag.create tag: "hogwarts"
|
56
62
|
```
|
57
63
|
|
58
64
|
#### Contact tags
|
@@ -69,7 +75,7 @@ harry.remove_tag "hogwarts"
|
|
69
75
|
|
70
76
|
## Contributing
|
71
77
|
|
72
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
78
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/wedsonlima/ractive_campaign. 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/[USERNAME]/ractive_campaign/blob/master/CODE_OF_CONDUCT.md).
|
73
79
|
|
74
80
|
## License
|
75
81
|
|
@@ -10,16 +10,16 @@ module ActiveCampaign
|
|
10
10
|
HTTP_METHODS.each do |method|
|
11
11
|
class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
12
12
|
def #{method}(path, params={})
|
13
|
-
root = params.delete(:_root)
|
14
|
-
|
15
13
|
send(:'#{method}_raw', path, params) do |parsed_data, response|
|
16
14
|
return {} unless [200, 201].include?(parsed_data[:status_code])
|
17
15
|
return {} unless parsed_data[:data].present?
|
18
16
|
|
19
|
-
data = if
|
20
|
-
parsed_data[:data][
|
17
|
+
data = if parsed_data[:data].keys.include?(root_element.to_sym)
|
18
|
+
parsed_data[:data][root_element.to_sym]
|
19
|
+
elsif parsed_data[:data].keys.include?(root_elements.to_sym)
|
20
|
+
parsed_data[:data][root_elements.to_sym]
|
21
21
|
else
|
22
|
-
parsed_data[:data]
|
22
|
+
parsed_data[:data]
|
23
23
|
end
|
24
24
|
|
25
25
|
if data.is_a?(Array)
|
@@ -24,14 +24,22 @@ module ActiveCampaign
|
|
24
24
|
ContactTag.get "#{self.class.endpoint}/#{id}/contactTags"
|
25
25
|
end
|
26
26
|
|
27
|
-
# @example
|
27
|
+
# @example Add a tag to a contact.
|
28
28
|
#
|
29
29
|
# ActiveCampaign::Contact.find(1).add_tag "tag-name"
|
30
30
|
#
|
31
|
-
|
31
|
+
# Don't create the tag if it doesn't exist.
|
32
|
+
#
|
33
|
+
# ActiveCampaign::Contact.find(1).add_tag "tag-name", create_if_not_found: false
|
34
|
+
#
|
35
|
+
def add_tag(tag, create_if_not_found: true)
|
32
36
|
tag_id = Tag.find_by(tag: tag)&.id
|
33
37
|
|
34
|
-
ActiveCampaign::
|
38
|
+
tag_id = ActiveCampaign::Tag.create(tag: tag)&.id if !tag_id && create_if_not_found
|
39
|
+
|
40
|
+
return false unless tag_id
|
41
|
+
|
42
|
+
ActiveCampaign::ContactTag.create contact: id, tag: tag_id
|
35
43
|
end
|
36
44
|
|
37
45
|
# @example Remove a tag from a contact.
|
@@ -41,6 +49,8 @@ module ActiveCampaign
|
|
41
49
|
def remove_tag(tag)
|
42
50
|
tag_id = Tag.find_by(tag: tag)&.id
|
43
51
|
|
52
|
+
return false unless tag_id
|
53
|
+
|
44
54
|
contact_tag = contact_tags.filter_map { |ct| ct if ct.tag == tag_id }.last
|
45
55
|
|
46
56
|
contact_tag&.destroy
|
@@ -4,8 +4,8 @@ module ActiveCampaign
|
|
4
4
|
#
|
5
5
|
# @example ContactTags
|
6
6
|
#
|
7
|
-
# contact = ActiveCampaign::Contact.find(
|
8
|
-
# tag = ActiveCampaign::Tag.
|
7
|
+
# contact = ActiveCampaign::Contact.find(1)
|
8
|
+
# tag = ActiveCampaign::Tag.find(1)
|
9
9
|
#
|
10
10
|
# ActiveCampaing::ContactTag.create contact: contact, tag: tag
|
11
11
|
#
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ActiveCampaign
|
4
|
+
class CustomDealField < Model # :nodoc:
|
5
|
+
define_attributes :fieldLabel,
|
6
|
+
:fieldType,
|
7
|
+
:fieldDefault,
|
8
|
+
:isFormVisible,
|
9
|
+
:displayOrder
|
10
|
+
|
11
|
+
class << self
|
12
|
+
def endpoint
|
13
|
+
"dealCustomFieldMeta"
|
14
|
+
end
|
15
|
+
|
16
|
+
def root_element
|
17
|
+
:dealCustomFieldMetum
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ActiveCampaign
|
4
|
+
class CustomDealFieldValue < Model # :nodoc:
|
5
|
+
define_attributes :dealId,
|
6
|
+
:customFieldId,
|
7
|
+
:fieldValue,
|
8
|
+
:fieldCurrency
|
9
|
+
|
10
|
+
class << self
|
11
|
+
def endpoint
|
12
|
+
"dealCustomFieldData"
|
13
|
+
end
|
14
|
+
|
15
|
+
def root_element
|
16
|
+
:dealCustomFieldDatum
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ActiveCampaign
|
4
|
+
class Deal < Model # :nodoc:
|
5
|
+
define_attributes :contact,
|
6
|
+
:account,
|
7
|
+
:description,
|
8
|
+
:currency,
|
9
|
+
:group,
|
10
|
+
:owner,
|
11
|
+
:percent,
|
12
|
+
:stage,
|
13
|
+
:status,
|
14
|
+
:title,
|
15
|
+
:value
|
16
|
+
end
|
17
|
+
end
|
@@ -2,46 +2,10 @@
|
|
2
2
|
|
3
3
|
module ActiveCampaign
|
4
4
|
class List < Model # :nodoc:
|
5
|
-
define_attributes :
|
6
|
-
:
|
7
|
-
:name,
|
8
|
-
:p_use_tracking,
|
9
|
-
:p_use_analytics_read,
|
10
|
-
:p_use_analytics_link,
|
11
|
-
:p_use_twitter,
|
12
|
-
:p_use_facebook,
|
13
|
-
:p_embed_image,
|
14
|
-
:p_use_captcha,
|
15
|
-
:send_last_broadcast,
|
16
|
-
:private,
|
17
|
-
:analytics_domains,
|
18
|
-
:analytics_source,
|
19
|
-
:analytics_ua,
|
20
|
-
:twitter_token,
|
21
|
-
:twitter_token_secret,
|
22
|
-
:facebook_session,
|
23
|
-
:carboncopy,
|
24
|
-
:subscription_notify,
|
25
|
-
:unsubscription_notify,
|
26
|
-
:require_name,
|
27
|
-
:get_unsubscribe_reason,
|
28
|
-
:to_name,
|
29
|
-
:optinoptout,
|
30
|
-
:sender_name,
|
31
|
-
:sender_addr1,
|
32
|
-
:sender_addr2,
|
33
|
-
:sender_city,
|
34
|
-
:sender_state,
|
35
|
-
:sender_zip,
|
36
|
-
:sender_country,
|
37
|
-
:sender_phone,
|
5
|
+
define_attributes :name,
|
6
|
+
:stringid,
|
38
7
|
:sender_url,
|
39
8
|
:sender_reminder,
|
40
|
-
:fulladdress,
|
41
|
-
:optinmessageid,
|
42
|
-
:optoutconf,
|
43
|
-
:deletestamp,
|
44
|
-
:udate,
|
45
9
|
:user
|
46
10
|
end
|
47
11
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ActiveCampaign
|
4
|
+
class Pipeline < Model # :nodoc:
|
5
|
+
define_attributes :allgroups,
|
6
|
+
:allusers,
|
7
|
+
:autoassign,
|
8
|
+
:currency,
|
9
|
+
:title,
|
10
|
+
:users
|
11
|
+
|
12
|
+
class << self
|
13
|
+
def endpoint
|
14
|
+
"dealGroups"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ActiveCampaign
|
4
|
+
class Stage < Model # :nodoc:
|
5
|
+
define_attributes :cardRegion1,
|
6
|
+
:cardRegion2,
|
7
|
+
:cardRegion3,
|
8
|
+
:cardRegion4,
|
9
|
+
:cardRegion5,
|
10
|
+
:color,
|
11
|
+
:dealOrder,
|
12
|
+
:group,
|
13
|
+
:order,
|
14
|
+
:title,
|
15
|
+
:width
|
16
|
+
class << self
|
17
|
+
def endpoint
|
18
|
+
"dealStages"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ActiveCampaign
|
4
|
+
class Task < Model # :nodoc:
|
5
|
+
define_attributes :title,
|
6
|
+
:ownerType,
|
7
|
+
:relid,
|
8
|
+
:status,
|
9
|
+
:note,
|
10
|
+
:duedate,
|
11
|
+
:edate,
|
12
|
+
:dealTasktype,
|
13
|
+
:assignee,
|
14
|
+
:triggerAutomationOnCreate,
|
15
|
+
:doneAutomation
|
16
|
+
|
17
|
+
class << self
|
18
|
+
def endpoint
|
19
|
+
"dealTasks"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ActiveCampaign
|
4
|
+
class User < Model # :nodoc:
|
5
|
+
class << self
|
6
|
+
def find_by_email(email)
|
7
|
+
get "#{endpoint}/email/#{email}"
|
8
|
+
end
|
9
|
+
|
10
|
+
def find_by_username(username)
|
11
|
+
get "#{endpoint}/username/#{username}"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ractive_campaign
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wedson Lima
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-11-
|
11
|
+
date: 2021-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.12.1
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 0.12.1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: faraday
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,7 +66,7 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 1.2.0
|
69
|
-
description:
|
69
|
+
description: Ruby API wrapper for ActiveCampaign API v3
|
70
70
|
email:
|
71
71
|
- wedson.sousa.lima@gmail.com
|
72
72
|
executables: []
|
@@ -89,19 +89,40 @@ files:
|
|
89
89
|
- lib/active_campaign/api_attributes.rb
|
90
90
|
- lib/active_campaign/api_http.rb
|
91
91
|
- lib/active_campaign/models/account.rb
|
92
|
+
- lib/active_campaign/models/account_contact.rb
|
92
93
|
- lib/active_campaign/models/address.rb
|
94
|
+
- lib/active_campaign/models/campaign.rb
|
93
95
|
- lib/active_campaign/models/contact.rb
|
96
|
+
- lib/active_campaign/models/contact_automation.rb
|
97
|
+
- lib/active_campaign/models/contact_deal.rb
|
94
98
|
- lib/active_campaign/models/contact_tag.rb
|
99
|
+
- lib/active_campaign/models/custom_deal_field.rb
|
100
|
+
- lib/active_campaign/models/custom_deal_field_value.rb
|
101
|
+
- lib/active_campaign/models/deal.rb
|
102
|
+
- lib/active_campaign/models/email_activity.rb
|
103
|
+
- lib/active_campaign/models/field.rb
|
104
|
+
- lib/active_campaign/models/field_value.rb
|
95
105
|
- lib/active_campaign/models/list.rb
|
96
106
|
- lib/active_campaign/models/model.rb
|
97
107
|
- lib/active_campaign/models/note.rb
|
108
|
+
- lib/active_campaign/models/pipeline.rb
|
109
|
+
- lib/active_campaign/models/stage.rb
|
98
110
|
- lib/active_campaign/models/tag.rb
|
111
|
+
- lib/active_campaign/models/task.rb
|
112
|
+
- lib/active_campaign/models/task_outcome.rb
|
113
|
+
- lib/active_campaign/models/task_type.rb
|
114
|
+
- lib/active_campaign/models/user.rb
|
99
115
|
- lib/active_campaign/parser.rb
|
100
116
|
- lib/active_campaign/version.rb
|
117
|
+
- lib/ractive_campaign.rb
|
101
118
|
homepage: https://github.com/wedsonlima/ractive_campaign
|
102
119
|
licenses:
|
103
120
|
- MIT
|
104
|
-
metadata:
|
121
|
+
metadata:
|
122
|
+
homepage_uri: https://github.com/wedsonlima/ractive_campaign
|
123
|
+
source_code_uri: https://github.com/wedsonlima/ractive_campaign
|
124
|
+
changelog_uri: https://github.com/wedsonlima/ractive_campaign/blob/main/CHANGELOG.md
|
125
|
+
documentation_uri: https://www.rubydoc.info/gems/ractive_campaign/0.1.5
|
105
126
|
post_install_message:
|
106
127
|
rdoc_options: []
|
107
128
|
require_paths:
|
@@ -120,5 +141,5 @@ requirements: []
|
|
120
141
|
rubygems_version: 3.0.3.1
|
121
142
|
signing_key:
|
122
143
|
specification_version: 4
|
123
|
-
summary:
|
144
|
+
summary: Ruby API wrapper for ActiveCampaign API v3
|
124
145
|
test_files: []
|