Method: Fabricio::Networking::AppRequestModelFactory#crash_count_request_model

Defined in:
lib/fabricio/networking/app_request_model_factory.rb

#crash_count_request_model(app_id, start_time, end_time, builds) ⇒ Fabricio::Networking::RequestModel

Returns a request model for obtaining the count of app crashes

Parameters:

  • app_id (String)
  • start_time (String)

    Timestamp of the start date

  • end_time (String)

    Timestamp of the end date

  • builds (Array)

    Multiple build versions. E.g. [‘4.0.1 (38)’]

Returns:



128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/fabricio/networking/app_request_model_factory.rb', line 128

def crash_count_request_model(app_id, start_time, end_time, builds)
  headers = {
      'Content-Type' => 'application/json'
  }
  builds_string = builds.map { |build|
    "\"#{build}\""
  }.join(',')
  body = {
    'query' => "query AppScalars($app_id:String!,$type:IssueType!) {project(externalId:$app_id) {crashlytics {scalars:scalars(synthesizedBuildVersions:[#{builds_string}],type:$type,start:#{start_time},end:#{end_time}) {crashes}}}}",
    'variables' => {
        'app_id' => app_id,
        'type' => 'crash'
    }
  }.to_json
  model = Fabricio::Networking::RequestModel.new do |config|
    config.type = :POST
    config.base_url = FABRIC_GRAPHQL_API_URL
    config.headers = headers
    config.body = body
  end
  model
end