Class: Fabricio::Networking::BuildRequestModelFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/fabricio/networking/build_request_model_factory.rb

Overview

This factory creates request models for fetching data for Build model object

Constant Summary collapse

FABRIC_API_URL =

Server constants

'https://fabric.io'
FABRIC_API_PATH =
'/api/v2'
FABRIC_APPS_ENDPOINT =
'/apps'
FABRIC_ORGANIZATIONS_ENDPOINT =
'/organizations'

Instance Method Summary collapse

Instance Method Details

#all_builds_request_model(session, app_id) ⇒ Fabricio::Networking::RequestModel

Returns a request model for obtaining the list of all builds for a specific app

Parameters:

Returns:



19
20
21
22
23
24
25
26
27
# File 'lib/fabricio/networking/build_request_model_factory.rb', line 19

def all_builds_request_model(session, app_id)
  path = "#{FABRIC_API_PATH}#{org_app_endpoint(session, app_id)}/beta_distribution/releases"
  model = Fabricio::Networking::RequestModel.new do |config|
    config.type = :GET
    config.base_url = FABRIC_API_URL
    config.api_path = path
  end
  model
end

#get_build_request_model(session, app_id, version, build_number) ⇒ Fabricio::Networking::RequestModel

Returns a request model for obtaining a specific build for a specific app

Parameters:

  • session (Fabricio::Authorization::Session)
  • app_id (String)
  • version (String)

    The version number. E.g. ‘4.0.0’

  • build_number (String)

    The build number. E.g. ‘48’

Returns:



36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/fabricio/networking/build_request_model_factory.rb', line 36

def get_build_request_model(session, app_id, version, build_number)
  path = "#{FABRIC_API_PATH}#{org_app_endpoint(session, app_id)}/beta_distribution/releases"
  params = {
      'app[display_version]' => version,
      'app[build_version]' => build_number
  }
  model = Fabricio::Networking::RequestModel.new do |config|
    config.type = :GET
    config.base_url = FABRIC_API_URL
    config.api_path = path
    config.params = params
  end
  model
end

#top_versions_request_model(session, app_id, start_time, end_time) ⇒ Fabricio::Networking::RequestModel

Returns a request model for obtaining an array of top versions for a given app

Parameters:

  • session (Fabricio::Authorization::Session)
  • app_id (String)
  • start_time (String)

    Timestamp of the start date

  • end_time (String)

    Timestamp of the end date

Returns:



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/fabricio/networking/build_request_model_factory.rb', line 58

def top_versions_request_model(session, app_id, start_time, end_time)
  path = "#{FABRIC_API_PATH}#{org_app_endpoint(session, app_id)}/growth_analytics/top_builds"
  params = {
      'app_id' => app_id,
      'start' => start_time,
      'end' => end_time
  }
  model = Fabricio::Networking::RequestModel.new do |config|
    config.type = :GET
    config.base_url = FABRIC_API_URL
    config.api_path = path
    config.params = params
  end
  model
end