Module: Cephalopod

Extended by:
Cephalopod
Included in:
Cephalopod
Defined in:
lib/cephalopod.rb,
lib/cephalopod/types.rb,
lib/cephalopod/adaptor.rb,
lib/cephalopod/version.rb,
lib/cephalopod/response.rb,
lib/cephalopod/models/gsp.rb,
lib/cephalopod/repos/base.rb,
lib/cephalopod/models/base.rb,
lib/cephalopod/models/link.rb,
lib/cephalopod/models/charge.rb,
lib/cephalopod/models/product.rb,
lib/cephalopod/models/consumption.rb,
lib/cephalopod/models/meter_point.rb,
lib/cephalopod/repos/v1/gsp/resource.rb,
lib/cephalopod/models/product_summary.rb,
lib/cephalopod/repos/v1/products/resource.rb,
lib/cephalopod/repos/v1/products/collection.rb,
lib/cephalopod/repos/v1/gas_meter_points/resource.rb,
lib/cephalopod/models/products/dual_register_charge.rb,
lib/cephalopod/models/products/single_register_charge.rb,
lib/cephalopod/repos/v1/electricity_meter_points/resource.rb,
lib/cephalopod/repos/v1/gas_meter_points/consumption/collection.rb,
lib/cephalopod/repos/v1/electricity_meter_points/consumption/collection.rb,
lib/cephalopod/repos/v1/products/tariffs/gas/standing_charges/collection.rb,
lib/cephalopod/repos/v1/products/tariffs/gas/standard_unit_rates/collection.rb,
lib/cephalopod/repos/v1/products/tariffs/electricity/day_unit_rates/collection.rb,
lib/cephalopod/repos/v1/products/tariffs/electricity/night_unit_rates/collection.rb,
lib/cephalopod/repos/v1/products/tariffs/electricity/standing_charges/collection.rb,
lib/cephalopod/repos/v1/products/tariffs/electricity/standard_unit_rates/collection.rb

Defined Under Namespace

Modules: Models, Repos, Types Classes: Adaptor, Error, Response

Constant Summary collapse

VERSION =
"0.2.0"

Instance Method Summary collapse

Instance Method Details

#clientObject



58
59
60
# File 'lib/cephalopod.rb', line 58

def client
  @client ||= Cephalopod::Adaptor.new(**config)
end

#configObject



51
52
53
54
55
56
# File 'lib/cephalopod.rb', line 51

def config
  @config ||= {
    base_url: 'https://api.octopus.energy',
    api_key:  'api_key'
  }
end

#configure {|config| ... } ⇒ Object

Yields:



47
48
49
# File 'lib/cephalopod.rb', line 47

def configure(&block)
  yield(config)
end

#electrical_consumption(mpan:, serial_number:, **args) ⇒ Object



66
67
68
# File 'lib/cephalopod.rb', line 66

def electrical_consumption(mpan:, serial_number:, **args)
  Cephalopod::Repos::V1::ElectricityMeterPoints::Consumption::Collection.new.get(mpan: mpan, serial_number: serial_number, **args)
end

#gas_consumption(mpan:, serial_number:, **args) ⇒ Object



70
71
72
# File 'lib/cephalopod.rb', line 70

def gas_consumption(mpan:, serial_number:, **args)
  Cephalopod::Repos::V1::GasMeterPoints::Consumption::Collection.new.get(mpan: mpan, serial_number: serial_number, **args)
end

#grid_supply_point(postcode:) ⇒ Object



74
75
76
# File 'lib/cephalopod.rb', line 74

def grid_supply_point(postcode:)
  Cephalopod::Repos::V1::GSP::Resource.new.get(query: {postcode: postcode})
end

#products(*args) ⇒ Object



62
63
64
# File 'lib/cephalopod.rb', line 62

def products(*args)
  Cephalopod::Repos::V1::Products::Collection.new.get(*args)
end