moxiworks_platform 0.12.1 → 0.13.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: f18819516515df721ad891ac39fa7159410ed6d6
4
- data.tar.gz: e44ff8b03862c92203bb421b3905eb87192bf4e7
3
+ metadata.gz: 52672cbf7bb8c410996194f501e7f13d00fd668f
4
+ data.tar.gz: 30410dc4fe5db3324fa1ae0348facbb438f9cd62
5
5
  SHA512:
6
- metadata.gz: 7092a8e0822e85c2d1c447b293ee4cf38fc7f3c36b3ddcef7f8e5cdbd7fc7aeea077a5220f0b4acb765f7cb48686ed3f71a769194b62360a2f8298c22845f746
7
- data.tar.gz: 1ed5616faa44b00e448f9fa9f95cd3a6e7fa4d8f0242d048b3afe181377eb23357fcf12407d244381bc4e0f8c4b9b83522d832db7ca0e1ae78032ea421913cff
6
+ metadata.gz: 39ccb3940c9bf5d006efdd03711a43c91f4c8d50ae2c9edb5c0c46ff744651c7673a168cf835de41da431a4b6fb9a3f23ad669436c83e7c16fbf96bfc9b648ef
7
+ data.tar.gz: 5f2ae2f3c7931b1e59fa79b5ecd3b2e9d462312c0bd3fade65fc457681559ba8103612d3022a2799e4151a7fc4a7d28a58d486a3494e045ae6de0311711849d2
@@ -1,3 +1,4 @@
1
+ require 'moxiworks_platform/moxi_response_array'
1
2
  require 'moxiworks_platform/version'
2
3
  require 'moxiworks_platform/session'
3
4
  require 'moxiworks_platform/config'
@@ -77,11 +77,12 @@ module MoxiworksPlatform
77
77
  raise ::MoxiworksPlatform::Exception::ArgumentError, "#{opt} required" if
78
78
  opts[opt].nil? or opts[opt].to_s.empty?
79
79
  end
80
- results = []
80
+ results = MoxiResponseArray.new()
81
81
  RestClient::Request.execute(method: :get,
82
82
  url: url,
83
83
  payload: opts, headers: self.headers) do |response|
84
84
  puts response if MoxiworksPlatform::Config.debug
85
+ results.headers = response.headers
85
86
  self.check_for_error_in_response(response)
86
87
  json = JSON.parse(response)
87
88
  json['actions'].each do |r|
@@ -222,12 +222,13 @@ module MoxiworksPlatform
222
222
  raise ::MoxiworksPlatform::Exception::ArgumentError, "#{opt} required" if
223
223
  opts[opt].nil? or opts[opt].to_s.empty?
224
224
  end
225
- results = []
225
+ results = MoxiResponseArray.new()
226
226
  json = { 'page_number': 1, 'total_pages': 0, 'agents':[]}
227
227
  RestClient::Request.execute(method: :get,
228
228
  url: url,
229
229
  payload: opts, headers: self.headers) do |response|
230
230
  puts response if MoxiworksPlatform::Config.debug
231
+ results.headers = response.headers
231
232
  self.check_for_error_in_response(response)
232
233
  json = JSON.parse(response)
233
234
  json['agents'].each do |r|
@@ -403,12 +403,13 @@ module MoxiworksPlatform
403
403
  raise ::MoxiworksPlatform::Exception::ArgumentError, "#{opt} required" if
404
404
  opts[opt].nil? or opts[opt].to_s.empty?
405
405
  end
406
- results = []
406
+ results = MoxiResponseArray.new()
407
407
  json = { 'page_number': 1, 'total_pages': 0, 'transactions':[]}
408
408
  RestClient::Request.execute(method: :get,
409
409
  url: url,
410
410
  payload: opts, headers: self.headers) do |response|
411
411
  puts response if MoxiworksPlatform::Config.debug
412
+ results.headers = response.headers
412
413
  self.check_for_error_in_response(response)
413
414
  json = JSON.parse(response)
414
415
  json['transactions'].each do |r|
@@ -55,11 +55,12 @@ module MoxiworksPlatform
55
55
  raise ::MoxiworksPlatform::Exception::ArgumentError, "#{opt} required" if
56
56
  opts[opt].nil? or opts[opt].to_s.empty?
57
57
  end
58
- results = []
58
+ results = MoxiResponseArray.new()
59
59
  RestClient::Request.execute(method: :get,
60
60
  url: url,
61
61
  payload: opts, headers: self.headers) do |response|
62
62
  puts response if MoxiworksPlatform::Config.debug
63
+ results.headers = response.headers
63
64
  self.check_for_error_in_response(response)
64
65
  json = JSON.parse(response)
65
66
  json.each do |r|
@@ -44,7 +44,7 @@ module MoxiworksPlatform
44
44
  # the full name of this Contact
45
45
  #
46
46
  # @return [String] -- Default ''
47
- attr_accessor :contact_namer
47
+ attr_accessor :contact_name
48
48
 
49
49
  # @!attribute gender
50
50
  # the gender of this Contact. the first initial of either gender type may
@@ -542,15 +542,18 @@ module MoxiworksPlatform
542
542
  raise ::MoxiworksPlatform::Exception::ArgumentError, "#{opt} required" if
543
543
  opts[opt].nil? or opts[opt].to_s.empty?
544
544
  end
545
- results = []
545
+ results = MoxiResponseArray.new()
546
546
  RestClient::Request.execute(method: :get,
547
547
  url: url,
548
548
  payload: opts, headers: self.headers) do |response|
549
549
  puts response if MoxiworksPlatform::Config.debug
550
+ results.headers = response.headers
550
551
  self.check_for_error_in_response(response)
551
552
  json = JSON.parse(response)
552
- json.each do |r|
553
- results << MoxiworksPlatform::Contact.new(r) unless r.nil? or r.empty?
553
+ if json and json['contacts']
554
+ json['contacts'].each do |r|
555
+ results << MoxiworksPlatform::Contact.new(r) unless r.nil? or r.empty?
556
+ end
554
557
  end
555
558
  end
556
559
  results
@@ -793,9 +796,9 @@ module MoxiworksPlatform
793
796
 
794
797
  def int_attrs
795
798
  [:property_beds, :property_list_price, :search_min_year_built,
796
- :search_min_sq_ft, :search_min_price, :search_min_beds,
797
- :search_max_year_built, :search_max_sq_ft, :search_max_price,
798
- :search_min_lot_size, :search_max_lot_size]
799
+ :search_min_sq_ft, :search_min_price, :search_min_beds,
800
+ :search_max_year_built, :search_max_sq_ft, :search_max_price,
801
+ :search_min_lot_size, :search_max_lot_size]
799
802
  end
800
803
 
801
804
  end
@@ -85,11 +85,12 @@ module MoxiworksPlatform
85
85
  raise ::MoxiworksPlatform::Exception::ArgumentError, "#{opt} required" if
86
86
  opts[opt].nil? or opts[opt].to_s.empty?
87
87
  end
88
- results = []
88
+ results = MoxiResponseArray.new()
89
89
  RestClient::Request.execute(method: :get,
90
90
  url: url,
91
91
  payload: opts, headers: self.headers) do |response|
92
92
  puts response if MoxiworksPlatform::Config.debug
93
+ results.headers = response.headers
93
94
  self.check_for_error_in_response(response)
94
95
  json = JSON.parse(response)
95
96
  json.each do |r|
@@ -92,8 +92,7 @@ module MoxiworksPlatform
92
92
  # @option opts [Integer] :event_start Unix timestamp representing the start time of the event
93
93
  # @option opts [Integer] :event_end Unix timestamp representing the end time of the event
94
94
  # @option opts [Boolean] :all_day whether the event is an all day event
95
- # @option opts [String] :required_attendees comma separated list of attendee IDs using Contact IDs from your system (partner_contact_id) that have already been added to The Moxi Works Platform as a Contact
96
- # @option opts [String] :optional_attendees comma separated list of attendee IDs using Contact IDs from your system (partner_contact_id) that have already been added to The Moxi Works Platform as a Contact
95
+ # @option opts [String] :attendees comma separated list of attendee IDs using Contact IDs from your system (partner_contact_id) that have already been added to The Moxi Works Platform as a Contact
97
96
  #
98
97
  # @return [MoxiworksPlatform::Event]
99
98
  #
@@ -163,11 +162,12 @@ module MoxiworksPlatform
163
162
  raise ::MoxiworksPlatform::Exception::ArgumentError, "#{opt} required" if
164
163
  opts[opt].nil? or opts[opt].to_s.empty?
165
164
  end
166
- results = []
165
+ results = MoxiResponseArray.new()
167
166
  RestClient::Request.execute(method: :get,
168
167
  url: url,
169
168
  payload: opts, headers: self.headers) do |response|
170
169
  puts response if MoxiworksPlatform::Config.debug
170
+ results.headers = response.headers
171
171
  self.check_for_error_in_response(response)
172
172
  json = JSON.parse(response)
173
173
  json.each do |events_for_date|
@@ -198,8 +198,7 @@ module MoxiworksPlatform
198
198
  # @option opts [Integer] :event_start Unix timestamp representing the start time of the event
199
199
  # @option opts [Integer] :event_end Unix timestamp representing the end time of the event
200
200
  # @option opts [Boolean] :all_day whether the event is an all day event
201
- # @option opts [String] :required_attendees comma separated list of attendee IDs using Contact IDs from your system (partner_contact_id) that have already been added to The Moxi Works Platform as a Contact
202
- # @option opts [String] :optional_attendees comma separated list of attendee IDs using Contact IDs from your system (partner_contact_id) that have already been added to The Moxi Works Platform as a Contact
201
+ # @option opts [String] :attendees comma separated list of attendee IDs using Contact IDs from your system (partner_contact_id) that have already been added to The Moxi Works Platform as a Contact
203
202
  #
204
203
  # @return [MoxiworksPlatform::Event]
205
204
  #
@@ -279,8 +278,7 @@ module MoxiworksPlatform
279
278
  # @option opts [Integer] :event_end Unix timestamp representing the end time of the event
280
279
  # @option opts [Boolean] :recurring whether the event is a recurring event
281
280
  # @option opts [Boolean] :all_day whether the event is an all day event
282
- # @option opts [String] :required_attendees comma separated list of attendee IDs using Contact IDs from your system (partner_contact_id) that have already been added to The Moxi Works Platform as a Contact
283
- # @option opts [String] :optional_attendees comma separated list of attendee IDs using Contact IDs from your system (partner_contact_id) that have already been added to The Moxi Works Platform as a Contact
281
+ # @option opts [String] :attendees comma separated list of attendee IDs using Contact IDs from your system (partner_contact_id) that have already been added to The Moxi Works Platform as a Contact
284
282
  #
285
283
  # @return [MoxiworksPlatform::Event]
286
284
  #
@@ -84,12 +84,13 @@ module MoxiworksPlatform
84
84
 
85
85
  url = "#{MoxiworksPlatform::Config.url}/api/galleries/#{agent_identifier}"
86
86
 
87
- results = []
87
+ results = MoxiResponseArray.new()
88
88
  json = {'galleries': []}
89
89
  RestClient::Request.execute(method: :get,
90
90
  url: url,
91
91
  payload: opts, headers: self.headers) do |response|
92
92
  puts response if MoxiworksPlatform::Config.debug
93
+ results.headers = response.headers
93
94
  self.check_for_error_in_response(response)
94
95
  json = JSON.parse(response)
95
96
  json = self.underscore_attribute_names json
@@ -70,11 +70,12 @@ module MoxiworksPlatform
70
70
  raise ::MoxiworksPlatform::Exception::ArgumentError, "#{opt} required" if
71
71
  opts[opt].nil? or opts[opt].to_s.empty?
72
72
  end
73
- results = []
73
+ results = MoxiResponseArray.new()
74
74
  RestClient::Request.execute(method: :get,
75
75
  url: url,
76
76
  payload: opts, headers: self.headers) do |response|
77
77
  puts response if MoxiworksPlatform::Config.debug
78
+ results.headers = response.headers
78
79
  self.check_for_error_in_response(response)
79
80
  json = JSON.parse(response)
80
81
  json.each do |r|
@@ -300,7 +300,9 @@ module MoxiworksPlatform
300
300
  json = JSON.parse(response)
301
301
  json = self.underscore_attribute_names json
302
302
  return false if not json['status'].nil? and json['status'] =='fail'
303
- self.new(json) unless json.nil? or json.empty?
303
+ r = self.new(json) unless json.nil? or json.empty?
304
+ r.headers = response.headers unless r.nil?
305
+ r
304
306
  end
305
307
  end
306
308
 
@@ -370,12 +372,13 @@ module MoxiworksPlatform
370
372
  opts[:last_moxi_works_listing_id] ||= prev_page['listings'].last.moxi_works_listing_id
371
373
  end
372
374
 
373
- results = []
375
+ results = MoxiResponseArray.new()
374
376
  json = {'listings' => [], 'last_page' => true}
375
377
  RestClient::Request.execute(method: :get,
376
378
  url: url,
377
379
  payload: opts, headers: self.headers) do |response|
378
380
  puts response if MoxiworksPlatform::Config.debug
381
+ results.headers = response.headers
379
382
  self.check_for_error_in_response(response)
380
383
  json = JSON.parse(response)
381
384
  json = self.underscore_attribute_names json
@@ -0,0 +1,6 @@
1
+ class MoxiResponseArray < Array
2
+
3
+ attr_accessor :headers
4
+
5
+
6
+ end
@@ -142,12 +142,13 @@ module MoxiworksPlatform
142
142
  raise ::MoxiworksPlatform::Exception::ArgumentError, "#{opt} required" if
143
143
  opts[opt].nil? or opts[opt].to_s.empty?
144
144
  end
145
- results = []
145
+ results = MoxiResponseArray.new()
146
146
  json = { 'page_number': 1, 'total_pages': 0, 'offices':[]}
147
147
  RestClient::Request.execute(method: :get,
148
148
  url: url,
149
149
  payload: opts, headers: self.headers) do |response|
150
150
  puts response if MoxiworksPlatform::Config.debug
151
+ results.headers = response.headers
151
152
  self.check_for_error_in_response(response)
152
153
 
153
154
  json = JSON.parse(response)
@@ -136,12 +136,13 @@ module MoxiworksPlatform
136
136
  end
137
137
 
138
138
 
139
- results = []
139
+ results = MoxiResponseArray.new()
140
140
  json = { 'presentations':[]}
141
141
  RestClient::Request.execute(method: :get,
142
142
  url: url,
143
143
  payload: opts, headers: self.headers) do |response|
144
144
  puts response if MoxiworksPlatform::Config.debug
145
+ results.headers = response.headers
145
146
  self.check_for_error_in_response(response)
146
147
  json = JSON.parse(response)
147
148
  json['presentations'].each do |r|
@@ -6,6 +6,8 @@ module MoxiworksPlatform
6
6
  # provides underlying logic for connecting to Moxi Works Platform over HTTPS
7
7
  class Resource
8
8
 
9
+ attr_accessor :headers
10
+
9
11
  # class methods
10
12
 
11
13
  # keep a list of attr_accessors defined in this class
@@ -87,7 +89,9 @@ module MoxiworksPlatform
87
89
  self.check_for_error_in_response(response)
88
90
  json = JSON.parse(response)
89
91
  return false if not json['status'].nil? and json['status'] =='fail'
90
- self.new(json) unless json.nil? or json.empty?
92
+ r = self.new(json) unless json.nil? or json.empty?
93
+ r.headers = response.headers unless r.nil?
94
+ r
91
95
  end
92
96
  end
93
97
 
@@ -364,12 +364,13 @@ module MoxiworksPlatform
364
364
  raise ::MoxiworksPlatform::Exception::ArgumentError, "#{opt} required" if
365
365
  opts[opt].nil? or opts[opt].to_s.empty?
366
366
  end
367
- results = []
367
+ results = MoxiResponseArray.new()
368
368
  json = { 'page_number': 1, 'total_pages': 0, 'transactions':[]}
369
369
  RestClient::Request.execute(method: :get,
370
370
  url: url,
371
371
  payload: opts, headers: self.headers) do |response|
372
372
  puts response if MoxiworksPlatform::Config.debug
373
+ results.headers = response.headers
373
374
  self.check_for_error_in_response(response)
374
375
  json = JSON.parse(response)
375
376
  json['transactions'].each do |r|
@@ -309,7 +309,9 @@ module MoxiworksPlatform
309
309
  json = JSON.parse(response)
310
310
  json = self.underscore_attribute_names json
311
311
  return false if not json['status'].nil? and json['status'] =='fail'
312
- self.new(json) unless json.nil? or json.empty?
312
+ r = self.new(json) unless json.nil? or json.empty?
313
+ r.headers = response.headers unless r.nil?
314
+ r
313
315
  end
314
316
  end
315
317
 
@@ -379,12 +381,13 @@ module MoxiworksPlatform
379
381
  opts[:last_moxi_works_listing_id] ||= prev_page['listings'].last.moxi_works_listing_id
380
382
  end
381
383
 
382
- results = []
384
+ results = MoxiResponseArray.new()
383
385
  json = {'listings' => [], 'last_page' => true}
384
386
  RestClient::Request.execute(method: :get,
385
387
  url: url,
386
388
  payload: opts, headers: self.headers) do |response|
387
389
  puts response if MoxiworksPlatform::Config.debug
390
+ results.headers = response.headers
388
391
  self.check_for_error_in_response(response)
389
392
  json = JSON.parse(response)
390
393
  json = self.underscore_attribute_names json
@@ -180,13 +180,14 @@ module MoxiworksPlatform
180
180
  raise ::MoxiworksPlatform::Exception::ArgumentError, "#{opt} required" if
181
181
  opts[opt].nil? or opts[opt].to_s.empty?
182
182
  end
183
- results = []
183
+ results = MoxiResponseArray.new()
184
184
  json = { 'page_number': 1, 'total_pages': 0, 'tasks':[]}
185
185
  RestClient::Request.execute(method: :get,
186
186
  url: url,
187
187
  payload: opts, headers: self.headers) do |response|
188
188
  puts response if MoxiworksPlatform::Config.debug
189
189
  self.check_for_error_in_response(response)
190
+ results.headers = response.headers
190
191
  json = JSON.parse(response)
191
192
  json['tasks'].each do |r|
192
193
  results << MoxiworksPlatform::Task.new(r) unless r.nil? or r.empty?
@@ -186,11 +186,12 @@ module MoxiworksPlatform
186
186
 
187
187
  url = "#{MoxiworksPlatform::Config.url}/api/teams"
188
188
 
189
- results = []
189
+ results = MoxiResponseArray.new()
190
190
  RestClient::Request.execute(method: :get,
191
191
  url: url,
192
192
  payload: opts, headers: self.headers) do |response|
193
193
  puts response if MoxiworksPlatform::Config.debug
194
+ results.headers = response.headers
194
195
  self.check_for_error_in_response(response)
195
196
  json = JSON.parse(response)
196
197
  json = self.underscore_attribute_names json
@@ -1,3 +1,3 @@
1
1
  module MoxiworksPlatform
2
- VERSION = '0.12.1'
2
+ VERSION = '0.13.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.12.1
4
+ version: 0.13.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: 2018-02-23 00:00:00.000000000 Z
11
+ date: 2018-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -97,6 +97,7 @@ files:
97
97
  - lib/moxiworks_platform/gallery.rb
98
98
  - lib/moxiworks_platform/group.rb
99
99
  - lib/moxiworks_platform/listing.rb
100
+ - lib/moxiworks_platform/moxi_response_array.rb
100
101
  - lib/moxiworks_platform/office.rb
101
102
  - lib/moxiworks_platform/presentation_log.rb
102
103
  - lib/moxiworks_platform/resource.rb