Class: HockeyAppConfig
- Inherits:
-
Object
- Object
- HockeyAppConfig
- Defined in:
- lib/hockeyapp-config.rb
Constant Summary collapse
- PROPERTIES =
HockeyApp::Version::ATTRIBUTES + HockeyApp::Version::POST_PAYLOAD + [:app_id, :api_token]
Instance Method Summary collapse
- #api_token=(api_token) ⇒ Object
- #app ⇒ Object
- #client ⇒ Object
-
#initialize(config) ⇒ HockeyAppConfig
constructor
A new instance of HockeyAppConfig.
- #inspect ⇒ Object
-
#make_version ⇒ Object
Public: Creates a HockeyApp::Version object from this configuraiton.
- #mandatory=(mandatory) ⇒ Object
- #notify=(notify) ⇒ Object
Constructor Details
#initialize(config) ⇒ HockeyAppConfig
Returns a new instance of HockeyAppConfig.
27 28 29 |
# File 'lib/hockeyapp-config.rb', line 27 def initialize(config) @config = config end |
Instance Method Details
#api_token=(api_token) ⇒ Object
45 46 47 48 49 |
# File 'lib/hockeyapp-config.rb', line 45 def api_token=(api_token) @api_token = api_token config_client @api_token end |
#app ⇒ Object
39 40 41 42 43 |
# File 'lib/hockeyapp-config.rb', line 39 def app return if !client @app ||= HockeyApp::App.from_hash({"public_identifier" => app_id}, client) end |
#client ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/hockeyapp-config.rb', line 31 def client if !api_token puts "You need to specify a config.api_token" return end @client ||= HockeyApp.build_client end |
#inspect ⇒ Object
51 52 53 54 55 56 57 |
# File 'lib/hockeyapp-config.rb', line 51 def inspect h = {} PROPERTIES.each do |prop| h[prop] = self.send(prop) end h end |
#make_version ⇒ Object
Public: Creates a HockeyApp::Version object from this configuraiton
Returns the new HockeyApp::Version object
62 63 64 65 66 67 68 69 70 |
# File 'lib/hockeyapp-config.rb', line 62 def make_version version = HockeyApp::Version.new(app, client) version.notes = self.notes version.notes_type = HockeyApp::Version::NOTES_TYPES_TO_SYM.invert[self.notes_type] version.notify = HockeyApp::Version::NOTIFY_TO_BOOL.invert[self.notify] version.status = HockeyApp::Version::STATUS_TO_SYM.invert[self.status] version. = self. version end |
#mandatory=(mandatory) ⇒ Object
23 24 25 |
# File 'lib/hockeyapp-config.rb', line 23 def mandatory=(mandatory) @mandatory = string_or_num_to_bool(mandatory) end |
#notify=(notify) ⇒ Object
19 20 21 |
# File 'lib/hockeyapp-config.rb', line 19 def notify=(notify) @notify = string_or_num_to_bool(notify) end |