Class: HubriseApp::Refresher::Account

Inherits:
Base
  • Object
show all
Defined in:
app/lib/hubrise_app/refresher/account.rb

Constant Summary

Constants inherited from Base

Base::REFRESH_THRESHOLD

Class Method Summary collapse

Methods inherited from Base

from_api_client, from_event, run

Class Method Details

.attributes_from_api_call(resource, api_client) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'app/lib/hubrise_app/refresher/account.rb', line 6

def attributes_from_api_call(resource, api_client)
  {
    api_data: cleanup_api_data(
      if api_client.location_id
        api_client.get_location(api_client.location_id).data["account"]
      else
        api_client.(resource.hr_id).data
      end
    ),
  }
end

.attributes_from_event(event_params, _api_client) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
# File 'app/lib/hubrise_app/refresher/account.rb', line 18

def attributes_from_event(event_params, _api_client)
  {
    api_data: cleanup_api_data(
      if event_params["resource_type"] == "location"
        event_params["new_state"]["account"]
      else
        event_params["new_state"]
      end
    ),
  }
end