Class: HardCider::Client

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

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.

Parameters:

  • options (Hash) (defaults to: {})


8
9
10
# File 'lib/hard_cider/client.rb', line 8

def initialize(options = {})
  @client = AppStoreConnect::Client.new(options)
end

Instance Method Details

#latest_build(bundle_id) ⇒ Hash

Parameters:

  • bundle_id (String)

Returns:

  • (Hash)


14
15
16
17
18
19
20
21
22
23
# File 'lib/hard_cider/client.rb', line 14

def latest_build(bundle_id)
  response = @client.builds(
    limit: 1,
    filter: {
      app: app_id(bundle_id)
    }
  )

  response.dig(:data, 0)
end

#latest_build_processed?(bundle_id) ⇒ String

Parameters:

  • bundle_id (String)

Returns:

  • (String)


27
28
29
30
31
# File 'lib/hard_cider/client.rb', line 27

def latest_build_processed?(bundle_id)
  processing_state = latest_build(bundle_id).dig(:attributes, :processing_state)

  processing_state == 'VALID'
end