Class: Dawn::Gear

Inherits:
Object
  • Object
show all
Includes:
BaseApi
Defined in:
lib/dawn/api/models/gear.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from BaseApi

included, #to_h

Methods included from BaseApi::RequestExtension

#request

Methods included from SafeExtension

#safe

Constructor Details

#initialize(data) ⇒ Gear

Returns a new instance of Gear.

Parameters:

  • data (Hash)


29
30
31
32
# File 'lib/dawn/api/models/gear.rb', line 29

def initialize(data)
  @app = nil
  @data = data
end

Instance Attribute Details

#appDawn::App

Returns:



37
38
39
# File 'lib/dawn/api/models/gear.rb', line 37

def app
  @app ||= App.find(id: app_id)
end

Class Method Details

.destroy(options) ⇒ Object

Parameters:

  • options (Hash)


90
91
92
93
94
95
96
97
# File 'lib/dawn/api/models/gear.rb', line 90

def self.destroy(options)
  id = id_param(options)

  delete(
    path: "/gears/#{id}",
    query: options
  )
end

.find(options) ⇒ Object

Parameters:

  • options (Hash)


66
67
68
69
70
71
72
73
# File 'lib/dawn/api/models/gear.rb', line 66

def self.find(options)
  id = id_param(options)

  new get(
    path: "/gears/#{id}",
    query: options
  )["gear"]
end

.restart(options) ⇒ Object

Parameters:

  • options (Hash)


78
79
80
81
82
83
84
85
# File 'lib/dawn/api/models/gear.rb', line 78

def self.restart(options)
  id = id_param(options)

  post(
    path: "/gears/#{id}/restart",
    query: options
  )
end

Instance Method Details

#destroy(options = {}) ⇒ Object

Parameters:

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


59
60
61
# File 'lib/dawn/api/models/gear.rb', line 59

def destroy(options={})
  self.class.destroy(options.merge(id: id))
end

#refreshObject



41
42
43
44
45
46
47
# File 'lib/dawn/api/models/gear.rb', line 41

def refresh
  @data = get(
    path: "/gears/#{id}",
    query: options
  )["gear"]
  self
end

#restart(options = {}) ⇒ Object

Parameters:

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


52
53
54
# File 'lib/dawn/api/models/gear.rb', line 52

def restart(options={})
  self.class.restart(options.merge(id: id))
end