Class: Fastlane::FirebaseDevice
- Inherits:
-
Object
- Object
- Fastlane::FirebaseDevice
- Defined in:
- lib/fastlane/plugin/wpmreleasetoolkit/models/firebase_device.rb
Instance Attribute Summary collapse
-
#locale ⇒ Object
readonly
Returns the value of attribute locale.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#orientation ⇒ Object
readonly
Returns the value of attribute orientation.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Class Method Summary collapse
- .locale_data ⇒ Object
- .model_data ⇒ Object
- .valid_locales ⇒ Object
- .valid_model_names ⇒ Object
- .valid_orientations ⇒ Object
- .valid_version_numbers ⇒ Object
- .verify_logged_in! ⇒ Object
- .version_data ⇒ Object
Instance Method Summary collapse
-
#initialize(model:, version:, orientation:, locale: 'en') ⇒ FirebaseDevice
constructor
A new instance of FirebaseDevice.
- #to_s ⇒ Object
Constructor Details
#initialize(model:, version:, orientation:, locale: 'en') ⇒ FirebaseDevice
Returns a new instance of FirebaseDevice.
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/models/firebase_device.rb', line 5 def initialize(model:, version:, orientation:, locale: 'en') raise 'Invalid Model' unless FirebaseDevice.valid_model_names.include? model raise 'Invalid Version' unless FirebaseDevice.valid_version_numbers.include? version raise 'Invalid Locale' unless FirebaseDevice.valid_locales.include? locale raise 'Invalid Orientation' unless FirebaseDevice.valid_orientations.include? orientation @model = model @version = version @locale = locale @orientation = orientation end |
Instance Attribute Details
#locale ⇒ Object (readonly)
Returns the value of attribute locale.
3 4 5 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/models/firebase_device.rb', line 3 def locale @locale end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
3 4 5 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/models/firebase_device.rb', line 3 def model @model end |
#orientation ⇒ Object (readonly)
Returns the value of attribute orientation.
3 4 5 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/models/firebase_device.rb', line 3 def orientation @orientation end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
3 4 5 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/models/firebase_device.rb', line 3 def version @version end |
Class Method Details
.locale_data ⇒ Object
42 43 44 45 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/models/firebase_device.rb', line 42 def locale_data FirebaseDevice.verify_logged_in! @locale_data ||= Fastlane::Actions.sh('gcloud', 'firebase', 'test', 'android', 'locales', 'list', '--format="json"', log: false) end |
.model_data ⇒ Object
47 48 49 50 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/models/firebase_device.rb', line 47 def model_data FirebaseDevice.verify_logged_in! @model_data ||= Fastlane::Actions.sh('gcloud', 'firebase', 'test', 'android', 'models', 'list', '--format="json"', log: false) end |
.valid_locales ⇒ Object
34 35 36 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/models/firebase_device.rb', line 34 def valid_locales JSON.parse(locale_data).map { |locale| locale['id'] } end |
.valid_model_names ⇒ Object
26 27 28 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/models/firebase_device.rb', line 26 def valid_model_names JSON.parse(model_data).map { |device| device['codename'] } end |
.valid_orientations ⇒ Object
38 39 40 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/models/firebase_device.rb', line 38 def valid_orientations %w[portrait landscape] end |
.valid_version_numbers ⇒ Object
30 31 32 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/models/firebase_device.rb', line 30 def valid_version_numbers JSON.parse(version_data).map { |version| version['apiLevel'].to_i } end |
.verify_logged_in! ⇒ Object
57 58 59 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/models/firebase_device.rb', line 57 def verify_logged_in! UI.user_error!('You must call `firebase_login` before creating a FirebaseDevice object') unless FirebaseAccount.authenticated? end |
.version_data ⇒ Object
52 53 54 55 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/models/firebase_device.rb', line 52 def version_data FirebaseDevice.verify_logged_in! @version_data ||= Fastlane::Actions.sh('gcloud', 'firebase', 'test', 'android', 'versions', 'list', '--format="json"', log: false) end |
Instance Method Details
#to_s ⇒ Object
17 18 19 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/models/firebase_device.rb', line 17 def to_s "model=#{@model},version=#{@version},locale=#{@locale},orientation=#{@orientation}" end |