Module: MagicAdmin::Util

Defined in:
lib/magic-admin/util.rb

Class Method Summary collapse

Class Method Details

.headers(secret_key) ⇒ Object

Description:

Method provides you request headers hash

Arguments:

secret_key: API Secret Key.

Returns:

hash with following keys.
    content-type:
    X-Magic-Secret-Key:
    User-Agent:


52
53
54
55
56
57
58
# File 'lib/magic-admin/util.rb', line 52

def self.headers(secret_key)
  {
    "content-type": "application/json",
    "X-Magic-Secret-Key": secret_key,
    "User-Agent": Util.user_agent
  }
end

.platform_infoObject

Description:

Method provides you platform information hash

Returns:

hash with following keys.
    platform:
    language:
    language_version:
    user_name:


16
17
18
19
20
21
22
23
# File 'lib/magic-admin/util.rb', line 16

def self.platform_info
  {
    platform: Config.platform,
    language: Config.language,
    language_version: Config.language_version,
    user_name: Config.user_name
  }
end

.user_agentObject

Description:

Method provides you user agent hash

Returns:

hash with following keys.
    sdk_version:
    publisher:
    platform:


33
34
35
36
37
38
39
# File 'lib/magic-admin/util.rb', line 33

def self.user_agent
  {
    sdk_version: MagicAdmin::VERSION,
    publisher: Config.publisher,
    platform: platform_info
  }
end