module Myra::Domains

Constants

PATH

Public Class Methods

create(domain) click to toggle source
# File lib/myra/actions/domains.rb, line 14
def self.create(domain)
  request = Request.new(path: PATH, type: :put)
  request.payload = Oj.dump(domain.to_hash)
  value = handle request
  Domain.from_hash(value['targetObject'].first)
end
delete(domain) click to toggle source
# File lib/myra/actions/domains.rb, line 21
def self.delete(domain)
  request = Request.new(path: PATH, type: :delete)
  payload = domain.to_hash.select { |k, _| %w(id modified).include?(k) }
  request.payload = Oj.dump(payload)
  value = handle request
  Domain.from_hash(value['targetObject'].first)
end
list(page = 1) click to toggle source
# File lib/myra/actions/domains.rb, line 9
def self.list(page = 1)
  values = handle Request.new(path: "#{PATH}/#{page}")
  values['list'].map { |domain| Domain.from_hash(domain) }
end
update(domain) click to toggle source
# File lib/myra/actions/domains.rb, line 29
def self.update(domain)
  request = Request.new path: PATH, type: :post
  payload = domain.to_hash.select do |k, _|
    %w(id modified autoUpdate).include? k
  end
  request.payload = Oj.dump(payload)
  value = handle request
  Domain.from_hash(value['targetObject'].first)
end