moxiworks_platform 0.3.0 → 0.4.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42c31e2e96f745d28cce316626e3952b28fa05ac
|
4
|
+
data.tar.gz: 86041d7a7ad42aec57dae357c05a8206f6eaeddd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a0175f05701d31299c62a6cf340440890547955e00254cf738667e797a1cf52fa259aea4128dca404b823b6d475fcd7b7d68dd08c45fd5ce23863dad2369d776
|
7
|
+
data.tar.gz: c3312668276b3cf23fa639aa6f773a891bfdf5508f6c9195c1dbebeb155c9e218388b954e99fcb007f14d6bfb45bab0a930c5c0406476471f077f677afa394a2
|
@@ -86,6 +86,12 @@ module MoxiworksPlatform
|
|
86
86
|
# @return [String] -- Default ''
|
87
87
|
attr_accessor :job_title
|
88
88
|
|
89
|
+
# @!attribute note
|
90
|
+
# more detailed information about the Contact
|
91
|
+
#
|
92
|
+
# @return [String] -- Default ''
|
93
|
+
attr_accessor :note
|
94
|
+
|
89
95
|
# @!attribute occupation
|
90
96
|
# the general occupation of this contact; ex: 'Software Developer'
|
91
97
|
#
|
@@ -302,6 +308,15 @@ module MoxiworksPlatform
|
|
302
308
|
# @return [Integer] -- Default nil
|
303
309
|
attr_writer :search_min_beds
|
304
310
|
|
311
|
+
# @!attribute search_min_lot_size
|
312
|
+
#
|
313
|
+
# the minimum lot size used by the contact when searching for listings
|
314
|
+
#
|
315
|
+
# Property Search (PS) attribute
|
316
|
+
#
|
317
|
+
# @return [Integer] -- Default nil
|
318
|
+
attr_writer :search_min_lot_size
|
319
|
+
|
305
320
|
# @!attribute search_min_price
|
306
321
|
#
|
307
322
|
# the minimum price used by the contact when searching for listings
|
@@ -713,7 +728,7 @@ module MoxiworksPlatform
|
|
713
728
|
[:property_beds, :property_list_price, :search_min_year_built,
|
714
729
|
:search_min_sq_ft, :search_min_price, :search_min_beds,
|
715
730
|
:search_max_year_built, :search_max_sq_ft, :search_max_price,
|
716
|
-
:search_max_lot_size]
|
731
|
+
:search_min_lot_size, :search_max_lot_size]
|
717
732
|
end
|
718
733
|
|
719
734
|
end
|
@@ -34,14 +34,8 @@ module MoxiworksPlatform
|
|
34
34
|
# @return [String]
|
35
35
|
attr_accessor :note
|
36
36
|
|
37
|
-
# @!attribute send_reminder
|
38
|
-
# whether a reminder should be sent to the agent
|
39
|
-
#
|
40
|
-
# @return [Boolean]
|
41
|
-
attr_accessor :send_reminder
|
42
|
-
|
43
37
|
# @!attribute remind_minutes_before
|
44
|
-
# how many minutes before the event a reminder should be sent
|
38
|
+
# how many minutes before the event a reminder should be sent
|
45
39
|
#
|
46
40
|
# @return [Integer]
|
47
41
|
attr_writer :remind_minutes_before
|
@@ -64,12 +58,6 @@ module MoxiworksPlatform
|
|
64
58
|
# @return [Integer]
|
65
59
|
attr_writer :event_end
|
66
60
|
|
67
|
-
# @!attribute recurring
|
68
|
-
# whether the event is recurring
|
69
|
-
#
|
70
|
-
# @return [Boolean]
|
71
|
-
attr_accessor :recurring
|
72
|
-
|
73
61
|
# @!attribute all_day
|
74
62
|
# whether the event is an all day event
|
75
63
|
#
|
@@ -87,12 +75,10 @@ module MoxiworksPlatform
|
|
87
75
|
# @option opts [String] :event_subject a brief human-readable description of the event
|
88
76
|
# @option opts [String] :event_location human-readable description of the event's location
|
89
77
|
# @option opts [String] :note human-readable details regarding the event
|
90
|
-
# @option opts [
|
91
|
-
# @option opts [Integer] :remind_minutes_before how many minutes before the event the reminder should be sent (if send_reminder is true)
|
78
|
+
# @option opts [Integer] :remind_minutes_before how many minutes before the event the reminder should be sent
|
92
79
|
# @option opts [Boolean] :is_meeting whether the event is a meeting
|
93
80
|
# @option opts [Integer] :event_start Unix timestamp representing the start time of the event
|
94
81
|
# @option opts [Integer] :event_end Unix timestamp representing the end time of the event
|
95
|
-
# @option opts [Boolean] :recurring whether the event is a recurring event
|
96
82
|
# @option opts [Boolean] :all_day whether the event is an all day event
|
97
83
|
#
|
98
84
|
# @return [MoxiworksPlatform::Event]
|
@@ -106,12 +92,10 @@ module MoxiworksPlatform
|
|
106
92
|
# event_subject: 'foo deeaz',
|
107
93
|
# event_location: '1234 there ave',
|
108
94
|
# note: 'yo, whatup?',
|
109
|
-
# send_reminder: true,
|
110
95
|
# remind_minutes_before: 10,
|
111
96
|
# is_meeting: true,
|
112
97
|
# event_start: Time.now.to_i,
|
113
98
|
# event_end: Time.now.to_i + 86400,
|
114
|
-
# recurring: false,
|
115
99
|
# all_day: false
|
116
100
|
# )
|
117
101
|
#
|
@@ -145,7 +129,7 @@ module MoxiworksPlatform
|
|
145
129
|
# { "date" => "MM/DD/YY",
|
146
130
|
# "events" => [ MoxiworkPlatform::Event, MoxiworkPlatform::Event ]
|
147
131
|
# }
|
148
|
-
|
132
|
+
#
|
149
133
|
# @raise ::MoxiworksPlatform::Exception::ArgumentError if required
|
150
134
|
# named parameters aren't included
|
151
135
|
#
|
@@ -193,12 +177,10 @@ module MoxiworksPlatform
|
|
193
177
|
# @option opts [String] :event_subject a brief human-readable description of the event
|
194
178
|
# @option opts [String] :event_location human-readable description of the event's location
|
195
179
|
# @option opts [String] :note human-readable details regarding the event
|
196
|
-
# @option opts [
|
197
|
-
# @option opts [Integer] :remind_minutes_before how many minutes before the event the reminder should be sent (if send_reminder is true)
|
180
|
+
# @option opts [Integer] :remind_minutes_before how many minutes before the event the reminder should be sent
|
198
181
|
# @option opts [Boolean] :is_meeting whether the event is a meeting
|
199
182
|
# @option opts [Integer] :event_start Unix timestamp representing the start time of the event
|
200
183
|
# @option opts [Integer] :event_end Unix timestamp representing the end time of the event
|
201
|
-
# @option opts [Boolean] :recurring whether the event is a recurring event
|
202
184
|
# @option opts [Boolean] :all_day whether the event is an all day event
|
203
185
|
#
|
204
186
|
# @return [MoxiworksPlatform::Event]
|
@@ -212,12 +194,10 @@ module MoxiworksPlatform
|
|
212
194
|
# event_subject: 'foo deeaz',
|
213
195
|
# event_location: '1234 there ave',
|
214
196
|
# note: 'yo, whatup?',
|
215
|
-
# send_reminder: true,
|
216
197
|
# remind_minutes_before: 10,
|
217
198
|
# is_meeting: true,
|
218
199
|
# event_start: Time.now.to_i,
|
219
200
|
# event_end: Time.now.to_i + 86400,
|
220
|
-
# recurring: false,
|
221
201
|
# all_day: false
|
222
202
|
# )
|
223
203
|
#
|
@@ -273,8 +253,7 @@ module MoxiworksPlatform
|
|
273
253
|
# @option opts [String] :event_subject a brief human-readable description of the event
|
274
254
|
# @option opts [String] :event_location human-readable description of the event's location
|
275
255
|
# @option opts [String] :note human-readable details regarding the event
|
276
|
-
# @option opts [
|
277
|
-
# @option opts [Integer] :remind_minutes_before how many minutes before the event the reminder should be sent (if send_reminder is true)
|
256
|
+
# @option opts [Integer] :remind_minutes_before how many minutes before the event the reminder should be sent
|
278
257
|
# @option opts [Boolean] :is_meeting whether the event is a meeting
|
279
258
|
# @option opts [Integer] :event_start Unix timestamp representing the start time of the event
|
280
259
|
# @option opts [Integer] :event_end Unix timestamp representing the end time of the event
|
@@ -0,0 +1,113 @@
|
|
1
|
+
module MoxiworksPlatform
|
2
|
+
# = Moxi Works Platform Event
|
3
|
+
class Group < MoxiworksPlatform::Resource
|
4
|
+
# @!attribute moxi_works_agent_id
|
5
|
+
# moxi_works_agent_id is the Moxi Works Platform ID of the agent which the group is
|
6
|
+
# associated with.
|
7
|
+
#
|
8
|
+
# this must be set for any Moxi Works Platform transaction
|
9
|
+
#
|
10
|
+
# @return [String] the Moxi Works Platform ID of the agent
|
11
|
+
attr_accessor :moxi_works_agent_id
|
12
|
+
|
13
|
+
# @!attribute moxi_works_group_id
|
14
|
+
# your system's event ID for the event
|
15
|
+
#
|
16
|
+
# @return [String] representing the name of the group on the Moxi Works Platform
|
17
|
+
attr_accessor :moxi_works_group_name
|
18
|
+
|
19
|
+
# @!attribute contacts
|
20
|
+
# the contacts in the group
|
21
|
+
#
|
22
|
+
# @return [Array] of MoxiworksPlatform::Contact objects
|
23
|
+
attr_reader :contacts
|
24
|
+
|
25
|
+
# Find an Event your system has previously created in Moxi Works Platform
|
26
|
+
# @param [Hash] opts named parameter Hash
|
27
|
+
# @option opts [String] :moxi_works_agent_id *REQUIRED* The Moxi Works Agent ID for the agent to which this event is associated
|
28
|
+
# @option opts [Integer] :moxi_works_group_id *REQUIRED* The Moxi Works Group ID for this group.
|
29
|
+
#
|
30
|
+
# @return [MoxiworksPlatform::Group]
|
31
|
+
#
|
32
|
+
# @raise ::MoxiworksPlatform::Exception::ArgumentError if required
|
33
|
+
# named parameters aren't included
|
34
|
+
#
|
35
|
+
# @raise ::MoxiworksPlatform::Exception::ArgumentError if moxi_works_group_id
|
36
|
+
# is not an Integer or an integer as a String
|
37
|
+
#
|
38
|
+
# @example
|
39
|
+
# results = MoxiworksPlatform::Group.find(
|
40
|
+
# moxi_works_agent_id: '123abc',
|
41
|
+
# moxi_works_group_name: 'foobar'
|
42
|
+
# )
|
43
|
+
#
|
44
|
+
def self.find(opts={})
|
45
|
+
required_opts = [:moxi_works_agent_id, :moxi_works_group_name]
|
46
|
+
required_opts.each do |opt|
|
47
|
+
raise ::MoxiworksPlatform::Exception::ArgumentError, "#{opt} required" if
|
48
|
+
opts[opt].nil? or opts[opt].empty?
|
49
|
+
end
|
50
|
+
url = "#{MoxiworksPlatform::Config.url}/api/groups/#{opts[:moxi_works_group_name]}"
|
51
|
+
group = nil
|
52
|
+
RestClient::Request.execute(method: :get,
|
53
|
+
url: url,
|
54
|
+
payload: opts, headers: self.headers) do |response|
|
55
|
+
puts response if MoxiworksPlatform::Config.debug
|
56
|
+
self.check_for_error_in_response(response)
|
57
|
+
json = JSON.parse(response)
|
58
|
+
return false if not json['status'].nil? and json['status'] =='fail'
|
59
|
+
group = MoxiworksPlatform::Group.new(json) unless json.nil? or json.empty?
|
60
|
+
end
|
61
|
+
group
|
62
|
+
end
|
63
|
+
|
64
|
+
|
65
|
+
# Search an Agent's Groups in Moxi Works Platform
|
66
|
+
# @param [Hash] opts named parameter Hash
|
67
|
+
# @option opts [String] :moxi_works_agent_id *REQUIRED* The Moxi Works Agent ID for the agent to which this event is associated
|
68
|
+
# @option opts [String] :moxi_works_group_name optional name to search for. If no name is provided, all of the Agent's Groups will be returned
|
69
|
+
#
|
70
|
+
# @return [Array] containing MoxiworksPlatform::Group objects formatted as follows:
|
71
|
+
#
|
72
|
+
# @raise ::MoxiworksPlatform::Exception::ArgumentError if required
|
73
|
+
# named parameters aren't included
|
74
|
+
#
|
75
|
+
# @example
|
76
|
+
# results = MoxiworksPlatform::Group.search(
|
77
|
+
# moxi_works_agent_id: '123abc',
|
78
|
+
# )
|
79
|
+
#
|
80
|
+
def self.search(opts={})
|
81
|
+
url ||= "#{MoxiworksPlatform::Config.url}/api/groups"
|
82
|
+
required_opts = [:moxi_works_agent_id]
|
83
|
+
required_opts.each do |opt|
|
84
|
+
raise ::MoxiworksPlatform::Exception::ArgumentError, "#{opt} required" if
|
85
|
+
opts[opt].nil? or opts[opt].empty?
|
86
|
+
end
|
87
|
+
results = []
|
88
|
+
RestClient::Request.execute(method: :get,
|
89
|
+
url: url,
|
90
|
+
payload: opts, headers: self.headers) do |response|
|
91
|
+
puts response if MoxiworksPlatform::Config.debug
|
92
|
+
self.check_for_error_in_response(response)
|
93
|
+
json = JSON.parse(response)
|
94
|
+
json.each do |r|
|
95
|
+
results << MoxiworksPlatform::Group.new(r) unless r.nil? or r.empty?
|
96
|
+
end
|
97
|
+
end
|
98
|
+
results
|
99
|
+
end
|
100
|
+
|
101
|
+
# @return [Array] of MoxiworksPlatform::Contact objects
|
102
|
+
def contacts=(contacts)
|
103
|
+
new_contacts = []
|
104
|
+
unless contacts.nil? or contacts.empty?
|
105
|
+
contacts.each do |c|
|
106
|
+
new_contacts << MoxiworksPlatform::Contact.new(c)
|
107
|
+
end
|
108
|
+
@contacts = new_contacts
|
109
|
+
end
|
110
|
+
new_contacts
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
@@ -124,6 +124,7 @@ module MoxiworksPlatform
|
|
124
124
|
val = self.instance_variable_get("@#{attr_name}")
|
125
125
|
return val.to_i if val.is_a? Numeric and opts[:type] == :integer
|
126
126
|
return val if val.is_a? Numeric
|
127
|
+
return 0 if val.nil? or val.empty?
|
127
128
|
val.gsub!(/[^[:digit:]|\.]/, '') if val.is_a? String
|
128
129
|
case opts[:type]
|
129
130
|
when :integer
|
data/lib/moxiworks_platform.rb
CHANGED
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.
|
4
|
+
version: 0.4.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-05-
|
11
|
+
date: 2016-05-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -89,6 +89,7 @@ files:
|
|
89
89
|
- lib/moxiworks_platform/credentials.rb
|
90
90
|
- lib/moxiworks_platform/event.rb
|
91
91
|
- lib/moxiworks_platform/exception.rb
|
92
|
+
- lib/moxiworks_platform/group.rb
|
92
93
|
- lib/moxiworks_platform/resource.rb
|
93
94
|
- lib/moxiworks_platform/version.rb
|
94
95
|
- moxiworks_platform.gemspec
|