Class: Rubyplat::Responses::Response

Inherits:
Object
  • Object
show all
Extended by:
Utils::Parser
Defined in:
lib/rubyplat/responses/response.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Utils::Parser

parse

Constructor Details

#initialize(params = {}) ⇒ Response

Returns a new instance of Response.

Parameters:

  • params (Hash) (defaults to: {})

    hash of params



11
12
13
14
15
16
17
18
# File 'lib/rubyplat/responses/response.rb', line 11

def initialize(params = {})
  @date = DateTime.parse(params.delete(:date)) if params[:date]

  params.each do |k,v|
    instance_variable_set("@#{k}", v)
    self.class.class_eval { attr_reader k }
  end
end

Class Method Details

.from_response_string(response) ⇒ Object



6
7
8
# File 'lib/rubyplat/responses/response.rb', line 6

def self.from_response_string(response)
  new(parse(response))
end