realogy 0.6.0 → 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: cd7ef6df4687d14ecd5f52c86533588c914184f0a9c3d68c78432d2ea5946aca
4
- data.tar.gz: 5a4ad93bc7453b08427c0de9bce3231809915e6ba2e9d557e62bd5861b3fc266
3
+ metadata.gz: 12d8e93945c23e56e01fbe630bec8fdbe5ce249bd3b005a86d4a6912d9784db4
4
+ data.tar.gz: 4d10e4f50b4966dc5c9ba7f3b520db7d521f9406799822bd80cf9f422c4589a5
5
5
  SHA512:
6
- metadata.gz: f43e3d9c6bb73e924a74d0788d116b81caee67a42d924a20c7f9f54217fd00b5934486bf618a8b2fb6f1733099881093c302945678ff0a9f034227dc65081372
7
- data.tar.gz: 7020419b4f767b7ad66cb5a4de2c2624db5f2fd8909d98431032b30da2db3f5f93fe4521c820eb35d2f37d3c1f42b5387bf1a34cd3a9fb06be5cd31611c04e4c
6
+ metadata.gz: bd20fd303e29928de9b4f087dca56ccaf4c42934bb17d1e71439bf343b02add61d9c449a0fa94b9bfe6fc959273006bb987cdcd7381dc7542134b844fef18a6b
7
+ data.tar.gz: ba898e4b69cd3db029e63db391117a337f10d66a2770a7ba932eb85885f44d8708c6c5dc2474688fef4cfed5123f388fa676675ed6ad67098ed5d6020074b94f
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|
@@ -1,3 +1,3 @@
1
1
  module Realogy
2
- VERSION = "0.6.0"
2
+ VERSION = "0.6.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: realogy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Edlund