hubrise_app 1.2.8 → 1.2.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 +4 -4
- data/app/lib/hubrise_app/refresher/account.rb +1 -1
- data/app/lib/hubrise_app/refresher/app_instance.rb +6 -6
- data/app/lib/hubrise_app/refresher/base.rb +3 -3
- data/app/lib/hubrise_app/refresher/catalog.rb +7 -7
- data/app/lib/hubrise_app/refresher/customer_list.rb +1 -1
- data/app/lib/hubrise_app/refresher/location.rb +1 -1
- data/lib/hubrise_app/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2458e9e26ff8db33b82c81bd6645860608ee0c32182070a65c0856360eace16a
|
|
4
|
+
data.tar.gz: ecae617677e07633eec06553ea7a735c54be23bb5959fae99d80b25012d6cc4d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d8d23311c388131485c855b329e49e576ba30c85e9a4ccd623d0c319ea6787981cdbf71609530085a04bc94ff70c15ba4d9643f8d7753ad0391f26017db28186
|
|
7
|
+
data.tar.gz: 5b0865fa370921e2b73bb57f1c171157d971fad8875d71a9112d89d05ba1c12309b596fc41d55c75631a6bebf9237de36452127ab4d74818e3bf9d84586c2872
|
|
@@ -22,17 +22,17 @@ module HubriseApp
|
|
|
22
22
|
resource
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
-
def from_event(resource, event_params)
|
|
25
|
+
def from_event(resource, event_params, api_client)
|
|
26
26
|
case event_params["resource_type"]
|
|
27
27
|
when "account"
|
|
28
|
-
HubriseApp::Refresher::Account.from_event(resource.account, event_params)
|
|
28
|
+
HubriseApp::Refresher::Account.from_event(resource.account, event_params, api_client)
|
|
29
29
|
when "location"
|
|
30
|
-
HubriseApp::Refresher::Location.from_event(resource.location, event_params)
|
|
31
|
-
HubriseApp::Refresher::Account.from_event(resource.account, event_params)
|
|
30
|
+
HubriseApp::Refresher::Location.from_event(resource.location, event_params, api_client)
|
|
31
|
+
HubriseApp::Refresher::Account.from_event(resource.account, event_params, api_client)
|
|
32
32
|
when "catalog"
|
|
33
|
-
HubriseApp::Refresher::Catalog.from_event(resource.catalog, event_params)
|
|
33
|
+
HubriseApp::Refresher::Catalog.from_event(resource.catalog, event_params, api_client)
|
|
34
34
|
when "customer_list"
|
|
35
|
-
HubriseApp::Refresher::CustomerList.from_event(resource.customer_list, event_params)
|
|
35
|
+
HubriseApp::Refresher::CustomerList.from_event(resource.customer_list, event_params, api_client)
|
|
36
36
|
end
|
|
37
37
|
end
|
|
38
38
|
|
|
@@ -16,11 +16,11 @@ module HubriseApp
|
|
|
16
16
|
end
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
def from_event(resource, event_params)
|
|
19
|
+
def from_event(resource, event_params, api_client)
|
|
20
20
|
return if resource.nil?
|
|
21
21
|
|
|
22
22
|
resource.update!(
|
|
23
|
-
attributes_from_event(event_params).merge(
|
|
23
|
+
attributes_from_event(event_params, api_client).merge(
|
|
24
24
|
refreshed_at: Time.now,
|
|
25
25
|
)
|
|
26
26
|
)
|
|
@@ -44,7 +44,7 @@ module HubriseApp
|
|
|
44
44
|
{}
|
|
45
45
|
end
|
|
46
46
|
|
|
47
|
-
def attributes_from_event(event_params)
|
|
47
|
+
def attributes_from_event(event_params, _api_client)
|
|
48
48
|
event_params
|
|
49
49
|
end
|
|
50
50
|
|
|
@@ -5,22 +5,22 @@ module HubriseApp
|
|
|
5
5
|
class << self
|
|
6
6
|
def attributes_from_api_call(resource, api_client)
|
|
7
7
|
{
|
|
8
|
-
api_data:
|
|
9
|
-
api_client.get_catalog(resource.hr_id, hide_data: true).data
|
|
10
|
-
),
|
|
8
|
+
api_data: fetch_api_data(resource.hr_id, api_client),
|
|
11
9
|
}
|
|
12
10
|
end
|
|
13
11
|
|
|
14
|
-
def attributes_from_event(event_params)
|
|
12
|
+
def attributes_from_event(event_params, api_client)
|
|
15
13
|
{
|
|
16
|
-
api_data:
|
|
14
|
+
api_data:
|
|
15
|
+
# Catalog update events do not contain "new_state", so we need to fetch from the API
|
|
16
|
+
fetch_api_data(event_params["id"], api_client),
|
|
17
17
|
}
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
private
|
|
21
21
|
|
|
22
|
-
def
|
|
23
|
-
|
|
22
|
+
def fetch_api_data(catalog_id, api_client)
|
|
23
|
+
api_client.get_catalog(catalog_id, hide_data: true).data.except("id")
|
|
24
24
|
end
|
|
25
25
|
end
|
|
26
26
|
end
|
data/lib/hubrise_app/version.rb
CHANGED