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