Class: SgPostcode::ResponseBuilder::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/sg_postcode/response/response_builder.rb

Direct Known Subclasses

JsonOutput

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_data) ⇒ Builder

Initialize a new builder

All subclass of Builder will inherit this method

raw_data must have the ‘results’, follow is an array



10
11
12
13
# File 'lib/sg_postcode/response/response_builder.rb', line 10

def initialize(raw_data)
  # FIXME: check if the data is invalid
  @raw_data = raw_data['results'].first rescue nil
end

Instance Attribute Details

#raw_dataObject (readonly)

Returns the value of attribute raw_data.



4
5
6
# File 'lib/sg_postcode/response/response_builder.rb', line 4

def raw_data
  @raw_data
end

Instance Method Details

#dataObject

Implement this method in the subclass instead

Raises:

  • (NotImplementedError)


16
17
18
# File 'lib/sg_postcode/response/response_builder.rb', line 16

def data
  raise NotImplementedError
end