Class: Marver::Summary::Character

Inherits:
Object
  • Object
show all
Defined in:
lib/marver/entities/summary/character.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ Character

Returns a new instance of Character.



8
9
10
11
12
13
# File 'lib/marver/entities/summary/character.rb', line 8

def initialize(json)
  @id = json['id'].to_i
  @name = json['name']
  @resource_uri = json['resourceURI']
  @type = json['type'] || nil
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



6
7
8
# File 'lib/marver/entities/summary/character.rb', line 6

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/marver/entities/summary/character.rb', line 6

def name
  @name
end

#resource_uriObject (readonly)

Returns the value of attribute resource_uri.



6
7
8
# File 'lib/marver/entities/summary/character.rb', line 6

def resource_uri
  @resource_uri
end

#typeObject (readonly)

Returns the value of attribute type.



6
7
8
# File 'lib/marver/entities/summary/character.rb', line 6

def type
  @type
end

Instance Method Details

#fullObject



15
16
17
18
19
# File 'lib/marver/entities/summary/character.rb', line 15

def full
  response = Marver::API::Response.new(RestClient.get(@resource_uri))
  results = Marver::DataContainer.new(response).results
  Marver::Factory::Character.new(results).build
end