Class: Tinybucket::Api::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/tinybucket/api/base_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, model_class) ⇒ Parser

Returns a new instance of Parser.



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/tinybucket/api/base_api.rb', line 8

def initialize(type, model_class)
  parser_class =
    case type
    when :collection then Tinybucket::Parser::CollectionParser
    when :object     then Tinybucket::Parser::ObjectParser
    else throw "Unknown parser type: #{type}"
    end

  @type = parser_class
  @options = { model_class: model_class }
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



6
7
8
# File 'lib/tinybucket/api/base_api.rb', line 6

def options
  @options
end

#typeObject (readonly)

Returns the value of attribute type.



6
7
8
# File 'lib/tinybucket/api/base_api.rb', line 6

def type
  @type
end