moxiworks_platform 0.6.0 → 0.7.0

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
  SHA1:
3
- metadata.gz: 3d70046f5068c47a6d9178766c79098202ace1c2
4
- data.tar.gz: a1415726e2d739f552748550414726b00e4c4fd3
3
+ metadata.gz: f278e1a919743a23212ed85372496a5a0dbb1548
4
+ data.tar.gz: 09a94c3a6f1ff0781cafa1eed0da74b1f46954f0
5
5
  SHA512:
6
- metadata.gz: fb909fa1c8e6bf010df56b355778ca45075ab1b55efb1593163a0843a154b9798ba45b09b10a2063f5211d4c866466156166eb3acb1792a231ec1909d0c4fca0
7
- data.tar.gz: 2c5196daa5c8dee9fec32fd2a271c71d9ed7e9069c13cf2c4a86077d9c4078b5120b64acb8ddad3af63f0ffdca2ee576768c910e1b3f6e298b3d965ac6872c59
6
+ metadata.gz: 2d8359b4716ff34c27eb807f08eacd2c2b0c0c0224779ce8e23405c6eaa4c99f64710128f74d801e22d52831c67e508f3afa320a9d6cbf12fb5766d354eb791e
7
+ data.tar.gz: ea3eb6c0705395285192175c48824aa55eb58ee7d70194a7cb160f6429fb360a7584ba504d326aa4c42c45b00f013f84e7bcd71b205cdb7308069383172c1cd4
@@ -9,6 +9,7 @@ require 'moxiworks_platform/event'
9
9
  require 'moxiworks_platform/group'
10
10
  require 'moxiworks_platform/action_log'
11
11
  require 'moxiworks_platform/task'
12
+ require 'moxiworks_platform/email_campaign'
12
13
 
13
14
 
14
15
 
@@ -0,0 +1,109 @@
1
+ module MoxiworksPlatform
2
+ class EmailCampaign < MoxiworksPlatform::Resource
3
+ # @!attribute moxi_works_agent_id
4
+ # moxi_works_agent_id is the Moxi Works Platform ID of the agent which an ActionLog entry is
5
+ # or is to be associated with.
6
+ #
7
+ # this must be set for any Moxi Works Platform transaction
8
+ #
9
+ # @return [String] the Moxi Works Platform ID of the agent
10
+ attr_accessor :moxi_works_agent_id
11
+
12
+ # @!attribute partner_contact_id
13
+ # *your system's* unique ID for the Contact
14
+ #
15
+ # this must be set for any Moxi Works Platform transaction
16
+ #
17
+ # @return [String] your system's unique ID for the contact
18
+ attr_accessor :partner_contact_id
19
+
20
+ # @!attribute subscription_type
21
+ # the type of this EmailCampaign
22
+ #
23
+ # @return [String]
24
+ attr_accessor :subscription_type
25
+
26
+ # @!attribute email_address
27
+ # the email address that is configured for this email campaign
28
+ #
29
+ # @return [String]
30
+ attr_accessor :email_address
31
+
32
+ # @!attribute subscribed_at
33
+ # the Unix timestamp representing the date/time this campaign was created
34
+ #
35
+ # @return [Integer]
36
+ attr_writer :subscribed_at
37
+
38
+ # @!attribute area
39
+ # the area used for this EmailCampaign
40
+ #
41
+ # This will likely be simply a zip code, but allow for arbitrary human readable
42
+ # strings referencing geographical locations.
43
+ #
44
+ # @return [String]
45
+ attr_accessor :area
46
+
47
+ # @!attribute last_sent
48
+ # the Unix timestamp representing the date/time that the last email of this campaign was sent.
49
+ #
50
+ # if no email has been sent for this campaign, the value will be 0
51
+ #
52
+ # @return [Integer]
53
+ attr_writer :last_sent
54
+
55
+ # @!attribute next_scheduled
56
+ # the Unix timestamp representing the date/time the next email of this campaign will be sent.
57
+ #
58
+ # if no email is scheduled to be sent for this campaign, the value will be 0
59
+ #
60
+ # @return [Integer]
61
+ attr_writer :next_scheduled
62
+
63
+ # Search an Agent's Email Campaigns in Moxi Works Platform
64
+ # @param [Hash] opts named parameter Hash
65
+ # @option opts [String] :moxi_works_agent_id *REQUIRED* The Moxi Works Agent ID for the agent to which this contact is associated
66
+ # @option opts [String] :partner_contact_id *REQUIRED* Your system's unique ID for this contact.
67
+ #
68
+ # @return [Array] containing MoxiworkPlatform::EmailCampaign objects
69
+ #
70
+ # @raise ::MoxiworksPlatform::Exception::ArgumentError if required
71
+ # named parameters aren't included
72
+ #
73
+ # @example
74
+ # results = MoxiworksPlatform::EmailCampaign.search(
75
+ # moxi_works_agent_id: '123abc',
76
+ # partner_contact_id: 'mySystemsContactID'
77
+ # )
78
+ #
79
+ def self.search(opts={})
80
+ url ||= "#{MoxiworksPlatform::Config.url}/api/email_campaigns"
81
+ required_opts = [:moxi_works_agent_id, :partner_contact_id]
82
+ required_opts.each do |opt|
83
+ raise ::MoxiworksPlatform::Exception::ArgumentError, "#{opt} required" if
84
+ opts[opt].nil? or opts[opt].to_s.empty?
85
+ end
86
+ results = []
87
+ RestClient::Request.execute(method: :get,
88
+ url: url,
89
+ payload: opts, headers: self.headers) do |response|
90
+ puts response if MoxiworksPlatform::Config.debug
91
+ self.check_for_error_in_response(response)
92
+ json = JSON.parse(response)
93
+ json.each do |r|
94
+ results << MoxiworksPlatform::EmailCampaign.new(r) unless r.nil? or r.empty?
95
+ end
96
+ end
97
+ results
98
+ end
99
+
100
+ private
101
+
102
+ def int_attrs
103
+ [:subscribed_at, :next_scheduled, :last_sent]
104
+ end
105
+
106
+
107
+ end
108
+
109
+ end
@@ -86,12 +86,12 @@ module MoxiworksPlatform
86
86
  # @option opts [String] :moxi_works_agent_id *REQUIRED* The Moxi Works Agent ID for the agent to which this task is to be associated
87
87
  # @option opts [String] :partner_task_id *REQUIRED* Your system's unique ID for this task.
88
88
  # @option opts [String] :partner_contact_id *REQUIRED* Your system's unique ID for the Contact for whom this Task is to be associated.
89
+ # @option opts [Integer] :due_at *REQUIRED* Unix timestamp representing the due date
89
90
  #
90
91
  # optional Task parameters
91
92
  #
92
93
  # @option opts [String] :name short description of the task
93
94
  # @option opts [String] :description longer description of the task
94
- # @option opts [Integer] :due_at Unix timestamp representing the due date
95
95
  # @option opts [Integer] :duration Length of time in minutes that the task should take
96
96
  #
97
97
  # @return [MoxiworksPlatform::Task]
@@ -199,13 +199,13 @@ module MoxiworksPlatform
199
199
  # @option opts [String] :moxi_works_agent_id *REQUIRED* The Moxi Works Agent ID for the agent to which this task is to be associated
200
200
  # @option opts [String] :partner_task_id *REQUIRED* Your system's unique ID for this task.
201
201
  # @option opts [String] :partner_contact_id *REQUIRED* Your system's unique ID for the Contact for whom this Task is to be associated.
202
+ # @option opts [Integer] :due_at Unix timestamp representing the due date
203
+ # @option opts [Integer] :duration Length of time in minutes that the task should take
202
204
  #
203
205
  # optional Task parameters
204
206
  #
205
207
  # @option opts [String] :name short description of the task
206
208
  # @option opts [String] :description longer description of the task
207
- # @option opts [Integer] :due_at Unix timestamp representing the due date
208
- # @option opts [Integer] :duration Length of time in minutes that the task should take
209
209
  # @option opts [Integer] :completed_at Unix timestamp representing the date the task was completed
210
210
  # @option opts [String] :status enumerated string representing task status
211
211
  #
@@ -1,3 +1,3 @@
1
1
  module MoxiworksPlatform
2
- VERSION = '0.6.0'
2
+ VERSION = '0.7.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moxiworks_platform
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tres Wong-Godfrey
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-07-13 00:00:00.000000000 Z
11
+ date: 2016-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -88,6 +88,7 @@ files:
88
88
  - lib/moxiworks_platform/config.rb
89
89
  - lib/moxiworks_platform/contact.rb
90
90
  - lib/moxiworks_platform/credentials.rb
91
+ - lib/moxiworks_platform/email_campaign.rb
91
92
  - lib/moxiworks_platform/event.rb
92
93
  - lib/moxiworks_platform/exception.rb
93
94
  - lib/moxiworks_platform/group.rb