Class: Dawn::App::Gears
- Inherits:
-
Object
- Object
- Dawn::App::Gears
- Includes:
- BaseApi
- Defined in:
- lib/dawn/api/app/gears.rb
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
Instance Method Summary collapse
- #all(options = {}) ⇒ Object
- #create(options = {}) ⇒ Object
- #find(options = {}) ⇒ Object
-
#initialize(app) ⇒ Gears
constructor
A new instance of Gears.
- #restart(options = {}) ⇒ Object
Methods included from BaseApi
Methods included from BaseApi::Extension
Constructor Details
#initialize(app) ⇒ Gears
Returns a new instance of Gears.
12 13 14 |
# File 'lib/dawn/api/app/gears.rb', line 12 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/app/gears.rb', line 10 def app @app end |
Instance Method Details
#all(options = {}) ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/dawn/api/app/gears.rb', line 25 def all(={}) json_request( expects: 200, method: :get, path: "/apps/#{app.id}/gears", query: ).map { |hsh| Gear.new(hsh["gear"]).tap { |d| d.app = @app } } end |
#create(options = {}) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/dawn/api/app/gears.rb', line 16 def create(={}) Gear.new(json_request( expects: 200, method: :post, path: "/apps/#{app.id}/gears", body: .to_json )["gear"]).tap { |d| d.app = @app } end |
#find(options = {}) ⇒ Object
34 35 36 |
# File 'lib/dawn/api/app/gears.rb', line 34 def find(={}) Gear.find().tap { |d| d.app = @app } end |
#restart(options = {}) ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'lib/dawn/api/app/gears.rb', line 38 def restart(={}) request( expects: 200, method: :post, path: "/apps/#{app.id}/gears/restart", body: .to_json ) end |