class Tessera::Model::Base

Attributes

code[RW]
errors[RW]
response[RW]

Public Class Methods

new(response) click to toggle source
# File lib/tessera/model/base.rb, line 6
def initialize(response)
  @response = response
  @code = @response.code
  parse_errors if parsed_body
  parse_attributes if parsed_body
end

Protected Instance Methods

parse_attributes() click to toggle source
# File lib/tessera/model/base.rb, line 23
def parse_attributes
  raise NotImplementedError, 'Model must implement attribute mapping'
end
parse_errors() click to toggle source
# File lib/tessera/model/base.rb, line 15
def parse_errors
  @errors = parsed_body['Error']
end
parsed_body() click to toggle source
# File lib/tessera/model/base.rb, line 19
def parsed_body
  JSON.parse(@response.body) if @response.body
end