Module: Extension::Tasks::Converters::AppConverter

Defined in:
lib/project_types/extension/tasks/converters/app_converter.rb

Constant Summary collapse

API_KEY_FIELD =
"apiKey"
API_SECRET_KEYS_FIELD =
"apiSecretKeys"
API_SECRET_FIELD =
"secret"
TITLE_FIELD =
"title"
ORGANIZATION_NAME_FIELD =
"businessName"

Class Method Summary collapse

Class Method Details

.from_hash(hash, organization = {}) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/project_types/extension/tasks/converters/app_converter.rb', line 14

def self.from_hash(hash, organization = {})
  return nil if hash.nil?

  Models::App.new(
    api_key: hash[API_KEY_FIELD],
    secret: hash[API_SECRET_KEYS_FIELD].first[API_SECRET_FIELD],
    title: hash[TITLE_FIELD],
    business_name: organization[ORGANIZATION_NAME_FIELD]
  )
end