Module: TypeformData

Defined in:
lib/typeform_data/api_response.rb,
lib/typeform_data.rb,
lib/typeform_data/client.rb,
lib/typeform_data/config.rb,
lib/typeform_data/errors.rb,
lib/typeform_data/version.rb,
lib/typeform_data/typeform.rb,
lib/typeform_data/requestor.rb,
lib/typeform_data/value_class.rb,
lib/typeform_data/typeform/by_id.rb,
lib/typeform_data/typeform/field.rb,
lib/typeform_data/typeform/stats.rb,
lib/typeform_data/typeform/answer.rb,
lib/typeform_data/typeform/question.rb,
lib/typeform_data/typeform/response.rb,
lib/typeform_data/comparable_by_id_and_config.rb

Overview

As the code says, we’re using a simple decorator/delegator here to signal intent to possibly modify the TypeformData::ApiResponse API.

Defined Under Namespace

Modules: ComparableByIdAndConfig, Requestor, ValueClass Classes: ApiResponse, ArgumentError, BadRequest, Client, Config, ConnectionRefused, Error, InvalidApiKey, InvalidEndpointOrMissingResource, Typeform, UnexpectedError

Constant Summary collapse

VERSION =
'0.0.4'

Class Method Summary collapse

Class Method Details

.dump(object) ⇒ Object



4
5
6
# File 'lib/typeform_data.rb', line 4

def self.dump(object)
  Marshal.dump(object)
end

.load(value_class_instance, config) ⇒ Object

Currently only handles single objects and arrays.



11
12
13
14
15
16
17
18
19
20
# File 'lib/typeform_data.rb', line 11

def self.load(value_class_instance, config)
  Marshal.load(value_class_instance).tap { |marshaled|
    case marshaled
    when Array
      marshaled.each { |object| object.reconfig(config) }
    else
      marshaled.reconfig(config)
    end
  }
end