Class: MonogotoApi::IP

Inherits:
Object
  • Object
show all
Defined in:
lib/monogoto_api/ip.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**attributes) ⇒ IP

Returns a new instance of IP.



7
8
9
10
11
12
# File 'lib/monogoto_api/ip.rb', line 7

def initialize(**attributes)
    @ip                   = attributes[:ip]
    @ip_allocation_policy = attributes[:ip_allocation_policy]
    @ip_lock              = attributes[:ip_lock]
    @ipv_type             = attributes[:ipv_type]
end

Instance Attribute Details

#ipObject (readonly)

Returns the value of attribute ip.



5
6
7
# File 'lib/monogoto_api/ip.rb', line 5

def ip
  @ip
end

#ip_allocation_policyObject (readonly)

Returns the value of attribute ip_allocation_policy.



5
6
7
# File 'lib/monogoto_api/ip.rb', line 5

def ip_allocation_policy
  @ip_allocation_policy
end

#ip_lockObject (readonly)

Returns the value of attribute ip_lock.



5
6
7
# File 'lib/monogoto_api/ip.rb', line 5

def ip_lock
  @ip_lock
end

#ipv_typeObject (readonly)

Returns the value of attribute ipv_type.



5
6
7
# File 'lib/monogoto_api/ip.rb', line 5

def ipv_type
  @ipv_type
end

Class Method Details

.parse(hash_ip) ⇒ Object



22
23
24
25
26
27
28
29
# File 'lib/monogoto_api/ip.rb', line 22

def self.parse(hash_ip)
    new(
        ip: hash_ip["IP"],
        ip_allocation_policy: hash_ip["IPAllocationPolicy"],
        ip_lock: hash_ip["IPLock"],
        ipv_type: hash_ip["IPvType"]
    )
end

.parse_many(response) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/monogoto_api/ip.rb', line 14

def self.parse_many(response)
    output = []
    response.each do |pre_ip|
        output.push(parse(pre_ip))
    end
    output
end