Class: Bitmessage::ApiClient::Address

Inherits:
Object
  • Object
show all
Defined in:
lib/bitmessage/api_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash, label_encoded = false) ⇒ Address

Returns a new instance of Address.



10
11
12
13
14
15
# File 'lib/bitmessage/api_client.rb', line 10

def initialize hash, label_encoded = false
  self.label = label_encoded ? Base64.decode64(hash['label']) : hash['label']
  self.address = hash['address']
  self.stream = hash['stream'] if hash.keys.include?('stream')
  self.enabled = hash['enabled']
end

Instance Attribute Details

#addressObject

Returns the value of attribute address.



8
9
10
# File 'lib/bitmessage/api_client.rb', line 8

def address
  @address
end

#enabledObject

Returns the value of attribute enabled.



8
9
10
# File 'lib/bitmessage/api_client.rb', line 8

def enabled
  @enabled
end

#labelObject

Returns the value of attribute label.



8
9
10
# File 'lib/bitmessage/api_client.rb', line 8

def label
  @label
end

#streamObject

Returns the value of attribute stream.



8
9
10
# File 'lib/bitmessage/api_client.rb', line 8

def stream
  @stream
end

Instance Method Details

#to_sObject



17
18
19
# File 'lib/bitmessage/api_client.rb', line 17

def to_s
  "#{self.label} (#{self.address})"
end