Class: Lexile::Api::Resource

Inherits:
Object
  • Object
show all
Defined in:
lib/lexile/api/resource.rb

Direct Known Subclasses

Books

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Resource

initialize

Parameters:



21
22
23
# File 'lib/lexile/api/resource.rb', line 21

def initialize( client )
  @client = client
end

Class Method Details

.api_model(klass) ⇒ Object

api_model

It tells the parser which Lexile::Model to use when parsing JSON and creating objects

Parameters:

  • klass (Lexile::Model)

    The Lexile::Model class to be used when parsing and objectifying responses.



10
11
12
13
14
15
16
# File 'lib/lexile/api/resource.rb', line 10

def api_model(klass)
  class_eval <<-END
          def api_model
  #{klass}
          end
  END
end