Class: Azure::ServiceBus::Resource

Inherits:
Object
  • Object
show all
Defined in:
lib/azure/service_bus/resource.rb

Direct Known Subclasses

Queue, Relay, Rule, Subscription, Topic

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, description = {}) {|_self| ... } ⇒ Resource

Public: Initialize the resource (either queue, topic, rule or subscription).

name - A String with the name of the resource. description - The resource description Hash

Yields:

  • (_self)

Yield Parameters:



25
26
27
28
29
# File 'lib/azure/service_bus/resource.rb', line 25

def initialize(name, description = {})
  @name = name
  @description = description
  yield self if block_given?
end

Instance Attribute Details

#author_nameObject

Public: Get the author name

Returns a String



56
57
58
# File 'lib/azure/service_bus/resource.rb', line 56

def author_name
  @author_name
end

#descriptionObject

Public: Resource description

Returns a Hash



61
62
63
# File 'lib/azure/service_bus/resource.rb', line 61

def description
  @description
end

#idObject Also known as: url

Get the Resource’s ID.

Returns a URI.



34
35
36
# File 'lib/azure/service_bus/resource.rb', line 34

def id
  @id
end

#nameObject Also known as: title

Get the Resource’s name.

Returns a String.



40
41
42
# File 'lib/azure/service_bus/resource.rb', line 40

def name
  @name
end

#publishedObject

Public: Get the published time

Returns a Time



46
47
48
# File 'lib/azure/service_bus/resource.rb', line 46

def published
  @published
end

#updatedObject

Public: Get the updated time

Returns a Time



51
52
53
# File 'lib/azure/service_bus/resource.rb', line 51

def updated
  @updated
end

Instance Method Details

#get_propsObject



63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/azure/service_bus/resource.rb', line 63

def get_props
  desc = description.dup
  props = []
  ordered_props.each { |prop_name|
    if desc[prop_name]
      props.push [prop_name, desc[prop_name]]
      desc.delete prop_name
    end
  }
  desc.each { |k,v|
    props.push [k, v]
  }
  props
end