Sha256: 0d871077a6e17619d97f27d8d12d4ea037516afad7a92a22cc5c320927a4c2d2

Contents?: true

Size: 562 Bytes

Versions: 2

Compression:

Stored size: 562 Bytes

Contents

module Easee
  class Site
    def initialize(data)
      @data = data.deep_symbolize_keys
    end

    def name = @data.fetch(:name)
    def street = address.fetch(:street)
    def building_number = address.fetch(:buildingNumber)
    def zip = address.fetch(:zip)
    def area = address.fetch(:area)
    def country_id = country[:id]
    def latitude = address.fetch(:latitude)
    def longitude = address.fetch(:longitude)

    private

    def country = address.fetch(:country) || {}

    def address
      @address ||= @data.fetch(:address)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
stekker_easee-1.0.2 lib/easee/site.rb
stekker_easee-1.0.1 lib/easee/site.rb