Class: DNSApp::Object

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/dnsapp/object.rb

Overview

:nodoc: all

Direct Known Subclasses

Domain, Record

Constant Summary collapse

@@parent_id =
nil

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = nil) ⇒ Object

Returns a new instance of Object.



45
46
47
48
49
50
51
52
# File 'lib/dnsapp/object.rb', line 45

def initialize(attributes=nil)
  attributes and attributes.each do |key, value|
    setter_method = "#{key}=".to_sym
    if self.respond_to?(setter_method)
      self.send(setter_method, value)
    end
  end
end

Class Method Details

.check_required_keys(hash, *keys) ⇒ Object



54
55
56
57
# File 'lib/dnsapp/object.rb', line 54

def self.check_required_keys(hash, *keys)
  hash.is_a? Hash or raise "Options must be given as a Hash"
  keys.each { |key| raise "Missing required option #{key}" if hash[key].nil? }
end

.delete(*args) ⇒ Object



33
34
35
36
# File 'lib/dnsapp/object.rb', line 33

def delete(*args)
  basic_auth DNSApp::Credentials.username, DNSApp::Credentials.password
  super
end

.get(*args) ⇒ Object



23
24
25
26
# File 'lib/dnsapp/object.rb', line 23

def get(*args)
  basic_auth DNSApp::Credentials.username, DNSApp::Credentials.password
  super
end

.post(*args) ⇒ Object



28
29
30
31
# File 'lib/dnsapp/object.rb', line 28

def post(*args)
  basic_auth DNSApp::Credentials.username, DNSApp::Credentials.password
  super
end

.put(*args) ⇒ Object



38
39
40
41
# File 'lib/dnsapp/object.rb', line 38

def put(*args)
  basic_auth DNSApp::Credentials.username, DNSApp::Credentials.password
  super
end

Instance Method Details

#parent_idObject



8
9
10
# File 'lib/dnsapp/object.rb', line 8

def parent_id
  @@parent_id
end

#parent_id=(id) ⇒ Object



12
13
14
# File 'lib/dnsapp/object.rb', line 12

def parent_id=(id)
  @@parent_id = id
end