Class: Dawn::App::Domains
- Inherits:
-
Object
- Object
- Dawn::App::Domains
- Includes:
- BaseApi
- Defined in:
- lib/dawn/api/app/domains.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) ⇒ Domains
constructor
A new instance of Domains.
Methods included from BaseApi
Methods included from BaseApi::Extension
Constructor Details
#initialize(app) ⇒ Domains
Returns a new instance of Domains.
12 13 14 |
# File 'lib/dawn/api/app/domains.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/domains.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/domains.rb', line 25 def all(={}) json_request( expects: 200, method: :get, path: "/apps/#{app.id}/domains", query: ).map { |hsh| Domain.new(hsh["domain"]).tap { |d| d.app = @app } } end |
#create(options = {}) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/dawn/api/app/domains.rb', line 16 def create(={}) Domain.new(json_request( expects: 200, method: :post, path: "/apps/#{app.id}/domains", body: .to_json )["domain"]).tap { |d| d.app = @app } end |
#find(options = {}) ⇒ Object
34 35 36 |
# File 'lib/dawn/api/app/domains.rb', line 34 def find(={}) Domain.find().tap { |d| d.app = @app } end |