Class: Dawn::App::Gears
- Inherits:
-
Object
- Object
- Dawn::App::Gears
- Includes:
- BaseApi, Enumerable
- Defined in:
- lib/dawn/api/models/app/gears.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
Instance Method Summary collapse
- #all(options = {}) ⇒ Array<Dawn::Gear>
- #create(options = {}) ⇒ Dawn::Gear
- #destroy(options) ⇒ Object
- #each({ |gear| do_stuff_with_gear }) ⇒ Object
- #find(options = {}) ⇒ Dawn::Gear
-
#initialize(app) ⇒ Gears
constructor
A new instance of Gears.
- #restart(options = {}) ⇒ Object
- #to_a ⇒ Array<Dawn::Gear>
Methods included from BaseApi
Methods included from BaseApi::RequestExtension
Methods included from SafeExtension
Constructor Details
#initialize(app) ⇒ Gears
Returns a new instance of Gears.
15 16 17 |
# File 'lib/dawn/api/models/app/gears.rb', line 15 def initialize(app) @app = app end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
10 11 12 |
# File 'lib/dawn/api/models/app/gears.rb', line 10 def app @app end |
Instance Method Details
#all(options = {}) ⇒ Array<Dawn::Gear>
48 49 50 51 52 53 |
# File 'lib/dawn/api/models/app/gears.rb', line 48 def all(={}) get( path: "/apps/#{app.id}/gears", query: ).map { |hsh| Gear.new(hsh["gear"]).tap { |d| d.app = @app } } end |
#create(options = {}) ⇒ Dawn::Gear
36 37 38 39 40 41 42 43 |
# File 'lib/dawn/api/models/app/gears.rb', line 36 def create(={}) #options.fetch(:gear) Gear.new(post( path: "/apps/#{app.id}/gears", body: .to_json )["gear"]).tap { |d| d.app = @app } end |
#destroy(options) ⇒ Object
69 70 71 |
# File 'lib/dawn/api/models/app/gears.rb', line 69 def destroy() Gear.destroy() end |
#each({ |gear| do_stuff_with_gear }) ⇒ Object
29 30 31 |
# File 'lib/dawn/api/models/app/gears.rb', line 29 def each(&block) all.each(&block) end |
#find(options = {}) ⇒ Dawn::Gear
58 59 60 |
# File 'lib/dawn/api/models/app/gears.rb', line 58 def find(={}) Gear.find().tap { |d| d.app = @app } end |
#restart(options = {}) ⇒ Object
62 63 64 65 66 67 |
# File 'lib/dawn/api/models/app/gears.rb', line 62 def restart(={}) post( path: "/apps/#{app.id}/gears/restart", body: .to_json ) end |
#to_a ⇒ Array<Dawn::Gear>
22 23 24 |
# File 'lib/dawn/api/models/app/gears.rb', line 22 def to_a all end |