realogy 0.5.4 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fdccbc57a69dba12dd4e280d1f280e405f8f35dd73a916f97c784963324a831e
4
- data.tar.gz: 99bbf7b835e01263583481808b0e51b0a56dfbee1539789ae2b98f60a77953b6
3
+ metadata.gz: 12d8e93945c23e56e01fbe630bec8fdbe5ce249bd3b005a86d4a6912d9784db4
4
+ data.tar.gz: 4d10e4f50b4966dc5c9ba7f3b520db7d521f9406799822bd80cf9f422c4589a5
5
5
  SHA512:
6
- metadata.gz: 995ac8526a4ff8d6aebba305488bf8db6d5d57ab3b896d2bd4098cf6e8910389599a11a5acd5fec308b7121f9061127ee801300cc386337539814a4f51ed5dce
7
- data.tar.gz: bf6bf683d3a2571c536c5588a51fb7f53ec9ce3b5889a976d394c7bd22701393f63654ed646676bf2135555e51c034c1547ad5e78140df87eaeb39f57a6b9fc3
6
+ metadata.gz: bd20fd303e29928de9b4f087dca56ccaf4c42934bb17d1e71439bf343b02add61d9c449a0fa94b9bfe6fc959273006bb987cdcd7381dc7542134b844fef18a6b
7
+ data.tar.gz: ba898e4b69cd3db029e63db391117a337f10d66a2770a7ba932eb85885f44d8708c6c5dc2474688fef4cfed5123f388fa676675ed6ad67098ed5d6020074b94f
data/.gitignore CHANGED
@@ -1,6 +1,5 @@
1
1
  /.bundle/
2
2
  /.yardoc
3
- /Gemfile.lock
4
3
  /_yardoc/
5
4
  /coverage/
6
5
  /doc/
data/Gemfile.lock ADDED
@@ -0,0 +1,70 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ realogy (0.5.9)
5
+ activerecord (>= 5.0)
6
+ oauth2
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ activemodel (7.0.2.3)
12
+ activesupport (= 7.0.2.3)
13
+ activerecord (7.0.2.3)
14
+ activemodel (= 7.0.2.3)
15
+ activesupport (= 7.0.2.3)
16
+ activesupport (7.0.2.3)
17
+ concurrent-ruby (~> 1.0, >= 1.0.2)
18
+ i18n (>= 1.6, < 2)
19
+ minitest (>= 5.1)
20
+ tzinfo (~> 2.0)
21
+ concurrent-ruby (1.1.9)
22
+ diff-lcs (1.5.0)
23
+ faraday (2.2.0)
24
+ faraday-net_http (~> 2.0)
25
+ ruby2_keywords (>= 0.0.4)
26
+ faraday-net_http (2.0.1)
27
+ i18n (1.10.0)
28
+ concurrent-ruby (~> 1.0)
29
+ jwt (2.3.0)
30
+ minitest (5.15.0)
31
+ multi_json (1.15.0)
32
+ multi_xml (0.6.0)
33
+ oauth2 (1.4.9)
34
+ faraday (>= 0.17.3, < 3.0)
35
+ jwt (>= 1.0, < 3.0)
36
+ multi_json (~> 1.3)
37
+ multi_xml (~> 0.5)
38
+ rack (>= 1.2, < 3)
39
+ rack (2.2.3)
40
+ rake (13.0.6)
41
+ rspec (3.11.0)
42
+ rspec-core (~> 3.11.0)
43
+ rspec-expectations (~> 3.11.0)
44
+ rspec-mocks (~> 3.11.0)
45
+ rspec-core (3.11.0)
46
+ rspec-support (~> 3.11.0)
47
+ rspec-expectations (3.11.0)
48
+ diff-lcs (>= 1.2.0, < 2.0)
49
+ rspec-support (~> 3.11.0)
50
+ rspec-mocks (3.11.0)
51
+ diff-lcs (>= 1.2.0, < 2.0)
52
+ rspec-support (~> 3.11.0)
53
+ rspec-support (3.11.0)
54
+ ruby2_keywords (0.0.5)
55
+ sqlite3 (1.4.2)
56
+ tzinfo (2.0.4)
57
+ concurrent-ruby (~> 1.0)
58
+
59
+ PLATFORMS
60
+ arm64-darwin-21
61
+
62
+ DEPENDENCIES
63
+ bundler (~> 2.3)
64
+ rake (>= 12.3.3)
65
+ realogy!
66
+ rspec (~> 3.0)
67
+ sqlite3
68
+
69
+ BUNDLED WITH
70
+ 2.3.7
data/README.md CHANGED
@@ -31,15 +31,16 @@ Set up for usage by creating Realogy's migration and running it.
31
31
  rails g realogy:install
32
32
  rails db:migrate
33
33
 
34
- Realogy is expecting these ENV variables to be present to be able to function:
34
+ Realogy is expecting these encrypted credentials to be present to be able to function:
35
35
 
36
36
  ```
37
- REALOGY_CLIENT_ID
38
- REALOGY_CLIENT_SECRET
39
- REALOGY_TOKEN_URL
40
- REALOGY_SCOPE
41
- REALOGY_SUBSCRIPTION_KEY
42
- REALOGY_API_BASE_URL
37
+ realogy:
38
+ client_id:
39
+ client_secret:
40
+ token_url:
41
+ scope:
42
+ subscription_key:
43
+ api_base_url:
43
44
  ```
44
45
 
45
46
  ### Available Rake Tasks
@@ -4,13 +4,13 @@ module Realogy
4
4
  require 'net/http'
5
5
  require 'oauth2'
6
6
  require 'json'
7
-
7
+
8
8
  @@instance = Realogy::DataSync.new
9
9
 
10
10
  def self.client
11
11
  return @@instance
12
12
  end
13
-
13
+
14
14
  private_class_method :new
15
15
 
16
16
  # API endpoints by type
@@ -81,13 +81,13 @@ module Realogy
81
81
  # Utility
82
82
 
83
83
  def uri_for_endpoint endpoint
84
- return URI([ENV["REALOGY_API_BASE_URL"], endpoint].join("/"))
84
+ return URI([Rails.application.credentials.dig(:realogy, :api_base_url), endpoint].join("/"))
85
85
  end
86
86
 
87
87
  def perform_simple_call(url)
88
88
  uri = URI(url)
89
89
  request = Net::HTTP::Get.new(uri)
90
- request['Ocp-Apim-Subscription-Key'] = ENV["REALOGY_SUBSCRIPTION_KEY"]
90
+ request['Ocp-Apim-Subscription-Key'] = Rails.application.credentials.dig(: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
93
  http.max_retries = 10
@@ -101,7 +101,7 @@ module Realogy
101
101
  uri = uri_for_endpoint(endpoint)
102
102
  uri.query && uri.query.length > 0 ? uri.query += '&' + query : uri.query = query
103
103
  request = Net::HTTP::Get.new(uri.request_uri)
104
- request['Ocp-Apim-Subscription-Key'] = ENV["REALOGY_SUBSCRIPTION_KEY"]
104
+ request['Ocp-Apim-Subscription-Key'] = Rails.application.credentials.dig(:realogy, :subscription_key)
105
105
  request['Authorization'] = "Bearer #{auth_token}"
106
106
  response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
107
107
  http.max_retries = 10
@@ -112,10 +112,10 @@ module Realogy
112
112
 
113
113
  def auth_token
114
114
  oauth2_client_credentials_token(
115
- ENV["REALOGY_CLIENT_ID"],
116
- ENV["REALOGY_CLIENT_SECRET"],
117
- ENV["REALOGY_TOKEN_URL"],
118
- ENV["REALOGY_SCOPE"]
115
+ Rails.application.credentials.dig(:realogy, :client_id),
116
+ Rails.application.credentials.dig(:realogy, :client_secret),
117
+ Rails.application.credentials.dig(:realogy, :token_url),
118
+ Rails.application.credentials.dig(:realogy, :scope)
119
119
  )
120
120
  end
121
121
 
@@ -148,9 +148,9 @@ OAuth2::AccessToken.class_eval do
148
148
  data = nil
149
149
  token = nil
150
150
  client = OAuth2::Client.new(
151
- ENV["REALOGY_CLIENT_ID"],
152
- ENV["REALOGY_CLIENT_SECRET"],
153
- token_url: ENV["REALOGY_TOKEN_URL"]
151
+ Rails.application.credentials.dig(:realogy, :client_id),
152
+ Rails.application.credentials.dig(:realogy, :client_secret),
153
+ token_url: Rails.application.credentials.dig(:realogy, :token_url)
154
154
  )
155
155
  if File.exists?(path)
156
156
  File.open(path) do |f|
@@ -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
 
@@ -1,3 +1,3 @@
1
1
  module Realogy
2
- VERSION = "0.5.4"
2
+ VERSION = "0.6.1"
3
3
  end
data/realogy.gemspec CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
23
  spec.require_paths = ["lib"]
24
24
 
25
- spec.add_development_dependency "bundler", "~> 1.14"
25
+ spec.add_development_dependency "bundler", "~> 2.3"
26
26
  spec.add_development_dependency "rake", ">= 12.3.3"
27
27
  spec.add_development_dependency "rspec", "~> 3.0"
28
28
  spec.add_development_dependency 'sqlite3'
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.4
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Edlund
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-05-19 00:00:00.000000000 Z
11
+ date: 2022-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.14'
19
+ version: '2.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.14'
26
+ version: '2.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -107,6 +107,7 @@ files:
107
107
  - ".travis.yml"
108
108
  - CODE_OF_CONDUCT.md
109
109
  - Gemfile
110
+ - Gemfile.lock
110
111
  - LICENSE.txt
111
112
  - README.md
112
113
  - Rakefile
@@ -134,7 +135,7 @@ homepage: https://github.com/arcticleo/realogy
134
135
  licenses:
135
136
  - MIT
136
137
  metadata: {}
137
- post_install_message:
138
+ post_install_message:
138
139
  rdoc_options: []
139
140
  require_paths:
140
141
  - lib
@@ -149,8 +150,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
150
  - !ruby/object:Gem::Version
150
151
  version: '0'
151
152
  requirements: []
152
- rubygems_version: 3.1.2
153
- signing_key:
153
+ rubygems_version: 3.3.7
154
+ signing_key:
154
155
  specification_version: 4
155
156
  summary: Encapsulation of Realogy's DataSync API.
156
157
  test_files: []