Class: Luciq::API::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/luciq/api/client.rb

Constant Summary collapse

SYMBOLS_FILES_PATH =
'/api/sdk/v3/symbols_files'
SO_FILES_PATH =
'/api/web/public/so_files'
FLUTTER_IOS_SYMBOLS_PATH =
'/api/web/public/flutter-symbol-files/ios'
FLUTTER_ANDROID_SYMBOLS_PATH =
'/api/web/public/flutter-symbol-files/android'

Instance Method Summary collapse

Constructor Details

#initializeClient

Returns a new instance of Client.



17
18
19
20
# File 'lib/luciq/api/client.rb', line 17

def initialize
  @token = Config.load_token
  @base_url = Config.load_base_url
end

Instance Method Details

#invoke_tool(tool_name, arguments = {}) ⇒ Object

Invokes a query tool by name with a hash of arguments (slug, mode, filters, pagination, ...) sent as a JSON body.



31
32
33
34
35
36
37
38
# File 'lib/luciq/api/client.rb', line 31

def invoke_tool(tool_name, arguments = {})
  uri = build_uri("/api/cli/tools/#{tool_name}")
  request = Net::HTTP::Post.new(uri)
  request['Content-Type'] = 'application/json'
  request.body = arguments.to_json
  apply_headers(request)
  execute(uri, request)
end

#upload_android_mapping(file_path:, app_token:, version_code:, version_name:) ⇒ Object



44
45
46
47
48
49
# File 'lib/luciq/api/client.rb', line 44

def upload_android_mapping(file_path:, app_token:, version_code:, version_name:)
  upload_mapping(
    file_path: file_path, app_token: app_token,
    version_code: version_code, version_name: version_name
  )
end

#upload_android_ndk(file_path:, app_token:, app_version:, arch:) ⇒ Object



51
52
53
# File 'lib/luciq/api/client.rb', line 51

def upload_android_ndk(file_path:, app_token:, app_version:, arch:)
  upload_so_file(file_path: file_path, app_token: app_token, app_version: app_version, arch: arch)
end

#upload_flutter_android_mapping(file_path:, app_token:, version_code:, version_name:) ⇒ Object



94
95
96
97
98
99
# File 'lib/luciq/api/client.rb', line 94

def upload_flutter_android_mapping(file_path:, app_token:, version_code:, version_name:)
  upload_mapping(
    file_path: file_path, app_token: app_token,
    version_code: version_code, version_name: version_name
  )
end

#upload_flutter_android_sourcemap(file_path:, app_token:, version_name:, version_code:) ⇒ Object



101
102
103
104
105
106
107
# File 'lib/luciq/api/client.rb', line 101

def upload_flutter_android_sourcemap(file_path:, app_token:, version_name:, version_code:)
  upload_flutter_symbols(
    FLUTTER_ANDROID_SYMBOLS_PATH,
    file_path: file_path, app_token: app_token,
    version_name: version_name, version_code: version_code
  )
end

#upload_flutter_ios_dsym(file_path:, app_token:) ⇒ Object



82
83
84
# File 'lib/luciq/api/client.rb', line 82

def upload_flutter_ios_dsym(file_path:, app_token:)
  upload_dsym(file_path: file_path, app_token: app_token)
end

#upload_flutter_ios_sourcemap(file_path:, app_token:, version_name:, version_code:) ⇒ Object



86
87
88
89
90
91
92
# File 'lib/luciq/api/client.rb', line 86

def upload_flutter_ios_sourcemap(file_path:, app_token:, version_name:, version_code:)
  upload_flutter_symbols(
    FLUTTER_IOS_SYMBOLS_PATH,
    file_path: file_path, app_token: app_token,
    version_name: version_name, version_code: version_code
  )
end

#upload_flutter_ndk(file_path:, app_token:, app_version:, arch:) ⇒ Object



109
110
111
# File 'lib/luciq/api/client.rb', line 109

def upload_flutter_ndk(file_path:, app_token:, app_version:, arch:)
  upload_so_file(file_path: file_path, app_token: app_token, app_version: app_version, arch: arch)
end

#upload_ios_dsym(file_path:, app_token:) ⇒ Object



40
41
42
# File 'lib/luciq/api/client.rb', line 40

def upload_ios_dsym(file_path:, app_token:)
  upload_dsym(file_path: file_path, app_token: app_token)
end

#upload_react_native_android_mapping(file_path:, app_token:, version_code:, version_name:) ⇒ Object



65
66
67
68
69
70
# File 'lib/luciq/api/client.rb', line 65

def upload_react_native_android_mapping(file_path:, app_token:, version_code:, version_name:)
  upload_mapping(
    file_path: file_path, app_token: app_token,
    version_code: version_code, version_name: version_name
  )
end

#upload_react_native_android_sourcemap(file_path:, app_token:, app_version:) ⇒ Object



72
73
74
75
76
# File 'lib/luciq/api/client.rb', line 72

def upload_react_native_android_sourcemap(file_path:, app_token:, app_version:)
  upload_react_native_sourcemap(
    file_path: file_path, app_token: app_token, os: 'android', app_version: app_version
  )
end

#upload_react_native_ios_dsym(file_path:, app_token:) ⇒ Object



55
56
57
# File 'lib/luciq/api/client.rb', line 55

def upload_react_native_ios_dsym(file_path:, app_token:)
  upload_dsym(file_path: file_path, app_token: app_token)
end

#upload_react_native_ios_sourcemap(file_path:, app_token:, app_version:) ⇒ Object



59
60
61
62
63
# File 'lib/luciq/api/client.rb', line 59

def upload_react_native_ios_sourcemap(file_path:, app_token:, app_version:)
  upload_react_native_sourcemap(
    file_path: file_path, app_token: app_token, os: 'ios', app_version: app_version
  )
end

#upload_react_native_ndk(file_path:, app_token:, app_version:, arch:) ⇒ Object



78
79
80
# File 'lib/luciq/api/client.rb', line 78

def upload_react_native_ndk(file_path:, app_token:, app_version:, arch:)
  upload_so_file(file_path: file_path, app_token: app_token, app_version: app_version, arch: arch)
end

#whoamiObject



22
23
24
25
26
27
# File 'lib/luciq/api/client.rb', line 22

def whoami
  uri = build_uri('/api/web/public/cli/whoami')
  request = Net::HTTP::Get.new(uri)
  apply_headers(request)
  execute(uri, request)
end