Class: Warframe::Models::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/warframe/models/base.rb

Overview

Warframe Base Model.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Base

Creates a new [Warframe::Models::Base] instance.

Parameters:

  • options (Hash, Array) (defaults to: {})

    a parsed JSON object, or collection of JSON objects.



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/warframe/models/base.rb', line 14

def initialize(options = {})
  if options.is_a? Array
    from_array options
  else
    options.each do |k, v|
      renamed = k.to_s.underscore
      v = v.map { |obj| OpenStruct.new obj } if v.is_a?(Array) && v[0].is_a?(Hash)
      v = OpenStruct.new v if v.is_a? Hash
      instance_variable_set "@#{renamed}", v
    end
  end
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



10
11
12
# File 'lib/warframe/models/base.rb', line 10

def code
  @code
end

#errorObject (readonly)

Returns the value of attribute error.



10
11
12
# File 'lib/warframe/models/base.rb', line 10

def error
  @error
end