realogy 0.5.0 → 0.5.9

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
  SHA256:
3
- metadata.gz: 1956befe99186c0f690a6062cf336f36f3327d74b7c6f0514d7703bc4b420ce7
4
- data.tar.gz: 1b04a0019d39011bec511cfe33a801efb38f6459e88c9cee566e442e630a173a
3
+ metadata.gz: 702562782515233ac1a57e61324cf10b14f66eb2d94bf886453cc8cc14901aa0
4
+ data.tar.gz: 24c5a742636e90ba401f524eff9f222d90a5c6bdc8745b3ef799bd8ba2f9a367
5
5
  SHA512:
6
- metadata.gz: c4d31c97eba0d008cba5c976a777a2dcaf1f5524fad8d11dc33f5af919d363d7a004f1ad27529ef94a8fa59d8ebe318770b0c2d979b52a0f8ef0e21f340f3f06
7
- data.tar.gz: ec22c1fa02006a364062d821641a844e34255ffa0dd6bbe70bde0503c3362dd295be946c9fca1920bf9efbcb074c05662a75da36275041ac388b1dbce63f72ce
6
+ metadata.gz: 6d3bdf26acc313331628f242681dc63a0ae8ce3668adff8c1f1496a40d2519b28f376bf129a0b79f8d1a8e2ed44652e2c8a2c83d88aba10b7f71d35ed4afd8ca
7
+ data.tar.gz: 9879729daada8cdc0f75acb0d5367ae22769d417f40ea5660312cff6eec63bf4dde6a477aca62529adac3a1d193dcb55b2586c72ff639af58afbaa55114b39e5
@@ -2,6 +2,7 @@ require "realogy/version"
2
2
  require "realogy/railtie" if defined?(Rails)
3
3
  require "realogy/app/models/application_record.rb"
4
4
  require "realogy/app/models/data_sync.rb"
5
+ require "realogy/app/models/search.rb"
5
6
  require "realogy/app/models/hash.rb"
6
7
  require "realogy/app/models/realogy/entity.rb"
7
8
  require "realogy/app/models/realogy/agent.rb"
@@ -43,7 +43,7 @@ module Realogy
43
43
 
44
44
  ACTIVE_API_ENDPOINTS.keys.each do |method_name|
45
45
  define_method method_name do |*args|
46
- hash = args.first.is_a?(Hash) ? args.first : {}
46
+ hash = args.first.is_a?(::Hash) ? args.first : {}
47
47
  endpoint = ACTIVE_API_ENDPOINTS[method_name]
48
48
  params = {
49
49
  'brandCode': hash[:brandCode],
@@ -56,7 +56,7 @@ module Realogy
56
56
  DELTA_API_ENDPOINTS.keys.each do |method_name|
57
57
  define_method method_name do |*args|
58
58
  entities = []
59
- hash = args.first.is_a?(Hash) ? args.first : {since: 15.minutes.ago}
59
+ hash = args.first.is_a?(::Hash) ? args.first : {since: 15.minutes.ago}
60
60
  params = {'since': JSON[hash[:since].to_json]}
61
61
  endpoint = DELTA_API_ENDPOINTS[method_name]
62
62
  response = perform_api_call(endpoint, params)
@@ -90,6 +90,7 @@ module Realogy
90
90
  request['Ocp-Apim-Subscription-Key'] = ENV["REALOGY_SUBSCRIPTION_KEY"]
91
91
  request['Authorization'] = "Bearer #{auth_token}"
92
92
  response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
93
+ http.max_retries = 10
93
94
  http.request(request)
94
95
  end
95
96
  return JSON(response.body)
@@ -103,6 +104,7 @@ module Realogy
103
104
  request['Ocp-Apim-Subscription-Key'] = ENV["REALOGY_SUBSCRIPTION_KEY"]
104
105
  request['Authorization'] = "Bearer #{auth_token}"
105
106
  response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
107
+ http.max_retries = 10
106
108
  http.request(request)
107
109
  end
108
110
  return JSON(response.body) rescue nil
@@ -163,7 +163,7 @@ class Realogy::Agent < Realogy::Entity
163
163
  # lastUpdateOn : DateTime
164
164
  # The date/time that the Agent record was last updated in the system (UTC)
165
165
 
166
- def last_update_on
166
+ def last_updated
167
167
  self.dig_for_datetime("lastUpdateOn")
168
168
  end
169
169
 
@@ -58,7 +58,7 @@ class Realogy::Company < Realogy::Entity
58
58
  # lastUpdateOn : DateTime
59
59
  # The date/time that the Company record was last updated in the system (UTC)
60
60
 
61
- def last_update_on
61
+ def last_updated
62
62
  self.dig_for_datetime("companySummary", "lastUpdateOn")
63
63
  end
64
64
 
@@ -887,7 +887,7 @@ class Realogy::Listing < Realogy::Entity
887
887
  # lastUpdateOn : DateTime
888
888
  # Timestamp when the listing was last updated at Realogy system
889
889
 
890
- def last_update_on
890
+ def last_updated
891
891
  self.dig_for_datetime("listingSummary", "lastUpdateOn")
892
892
  end
893
893
 
@@ -136,7 +136,7 @@ class Realogy::Office < Realogy::Entity
136
136
  # lastUpdateOn : DateTime
137
137
  # The date/time that the Office record was last updated in the system (UTC)
138
138
 
139
- def last_update_on
139
+ def last_updated
140
140
  self.dig_for_datetime("lastUpdateOn")
141
141
  end
142
142
 
@@ -44,7 +44,7 @@ class Realogy::Team < Realogy::Entity
44
44
  # lastUpdateOn : Datetime
45
45
  # The date/time in UTC when the team was last updated
46
46
 
47
- def last_update_on
47
+ def last_updated
48
48
  self.dig_for_datetime("lastUpdateOn")
49
49
  end
50
50
 
@@ -96,13 +96,13 @@ namespace :realogy do
96
96
  return unless %w(agents companies listings offices teams).include?(plural = klass.to_s.tableize.split("/").last)
97
97
  call = "get_#{plural}_delta".to_sym
98
98
  Realogy::DataSync.client.send(call, {since: since.to_i.minutes.ago}).each do |hash|
99
- case hash["action"] rescue nil
99
+ case hash["action"]
100
100
  when "Delete"
101
101
  klass.find_by(entity_id: hash["id"]).try(:destroy)
102
102
  when "Upsert"
103
103
  hash["class"] = klass.to_s
104
104
  active_job_configured? ? PopulateRealogyEntityJob.perform_later(hash) : klass::triage(hash)
105
- end
105
+ end rescue nil
106
106
  end
107
107
  end
108
108
 
@@ -1,3 +1,3 @@
1
1
  module Realogy
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.9"
3
3
  end
@@ -13,16 +13,7 @@ Gem::Specification.new do |spec|
13
13
  spec.description = %q{Encapsulates the Realogy DataSync API to synchronize local data store with the data maintained by Realogy.}
14
14
  spec.homepage = "https://github.com/arcticleo/realogy"
15
15
  spec.license = "MIT"
16
- spec.required_ruby_version = '>= 2.4.3'
17
-
18
- # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
19
- # to allow pushing to a single host or delete this section to allow pushing to any host.
20
- # if spec.respond_to?(:metadata)
21
- # spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
22
- # else
23
- # raise "RubyGems 2.0 or newer is required to protect against " \
24
- # "public gem pushes."
25
- # end
16
+ spec.required_ruby_version = '>= 2.5.3'
26
17
 
27
18
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
28
19
  f.match(%r{^(test|spec|features)/})
@@ -32,7 +23,7 @@ Gem::Specification.new do |spec|
32
23
  spec.require_paths = ["lib"]
33
24
 
34
25
  spec.add_development_dependency "bundler", "~> 1.14"
35
- spec.add_development_dependency "rake", "~> 10.0"
26
+ spec.add_development_dependency "rake", ">= 12.3.3"
36
27
  spec.add_development_dependency "rspec", "~> 3.0"
37
28
  spec.add_development_dependency 'sqlite3'
38
29
  spec.add_dependency "activerecord", ">= 5.0"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: realogy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Edlund
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-08-07 00:00:00.000000000 Z
11
+ date: 2020-12-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -28,16 +28,16 @@ dependencies:
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: 12.3.3
34
34
  type: :development
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: '10.0'
40
+ version: 12.3.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -142,15 +142,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - ">="
144
144
  - !ruby/object:Gem::Version
145
- version: 2.4.3
145
+ version: 2.5.3
146
146
  required_rubygems_version: !ruby/object:Gem::Requirement
147
147
  requirements:
148
148
  - - ">="
149
149
  - !ruby/object:Gem::Version
150
150
  version: '0'
151
151
  requirements: []
152
- rubyforge_project:
153
- rubygems_version: 2.7.6
152
+ rubygems_version: 3.1.4
154
153
  signing_key:
155
154
  specification_version: 4
156
155
  summary: Encapsulation of Realogy's DataSync API.