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