Class: Azure::Armrest::ArmrestCollection

Inherits:
Array
  • Object
show all
Defined in:
lib/azure/armrest/armrest_collection.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#continuation_tokenObject Also known as: skip_token

Returns the value of attribute continuation_token.



7
8
9
# File 'lib/azure/armrest/armrest_collection.rb', line 7

def continuation_token
  @continuation_token
end

Returns the value of attribute next_link.



6
7
8
# File 'lib/azure/armrest/armrest_collection.rb', line 6

def next_link
  @next_link
end

#response_codeObject

Returns the value of attribute response_code.



9
10
11
# File 'lib/azure/armrest/armrest_collection.rb', line 9

def response_code
  @response_code
end

#response_headersObject

Returns the value of attribute response_headers.



8
9
10
# File 'lib/azure/armrest/armrest_collection.rb', line 8

def response_headers
  @response_headers
end

Class Method Details

.create_from_response(response, klass = nil, skip_accessors_definition = false) ⇒ Object

Creates and returns a ArmrestCollection object based on JSON input, using klass to generate the list elements. In addition, both the response headers and continuation token are set.



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/azure/armrest/armrest_collection.rb', line 19

def create_from_response(response, klass = nil, skip_accessors_definition = false)
  json_response = JSON.parse(response)
  array = new(json_response['value'].map { |hash| klass.new(hash, skip_accessors_definition) })

  array.response_code = response.code
  array.response_headers = response.headers
  array.next_link = json_response['nextLink']
  array.continuation_token = parse_skip_token(array.next_link)

  array
end