megavats 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 318bea88780c70d3d9c0ca6b576e839e02969a4a401b8b0be5bf36f3e3231e1f
4
- data.tar.gz: 62174c10bf9b42188e886969c8e0e35137e6f0fb4ab2cd2f87d26c3e10d73b8a
3
+ metadata.gz: 2db7ad10a99afdd709949913d37a1097e06d1a1c9f429e62b61cd81174403f5a
4
+ data.tar.gz: 169dc9f82c23927d6960ec3f54f90a20109c4655b02e492f91263236cf0539a5
5
5
  SHA512:
6
- metadata.gz: 9558381150ab0d2051de5651bdd7b66bf7083062750f8e6d9382a5019ce34fb1c31cfcb25bf40ff2669cb748fec8261281c31db5c33bc57c0bcb85531a682f84
7
- data.tar.gz: 8eb9c8843480d3a7de28ad9c76c2bd44e8d929eec0a274d64fe575cea9daaadeb8c35c283d40fbdaee3f4d9049e02142eb6146dff69c5c5f89dc823f3958e002
6
+ metadata.gz: 5624924887e4663a1f20aa947f8ae241fd7bc49517f05c12645d69294e429bf0b2dd05fa2ab1a5ba074af51a3ab2da514bd655077230a3e25c7a7d57d1a0edc3
7
+ data.tar.gz: c2d62d3199eb559da609821d4156c7c9a8ab2a72675a8b18a89abc0cf095aae4dd669bad9883617ab68fa0e87e0ca00b5aa642c7605aafbde4d17beb9ab08522
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- megavats (0.1.0)
4
+ megavats (0.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,13 +1,24 @@
1
1
  module Megavats
2
2
  module History
3
+ AVAILABLE_PARAMS = [:start,:end,:period,:type,:limit]
4
+
3
5
  extend self
4
6
 
7
+
5
8
  def outer(params={})
6
- Megavats::Request.new("/history/json",'Get', true, params).json
9
+ Megavats::Request.new("/history/json#{params_string(params)}",'Get', true, {}).json
7
10
  end
8
11
 
9
12
  def inner(params={})
10
- Megavats::Request.new("/history/inner/json",'Get', true, params).json
13
+ Megavats::Request.new("/history/inner/json#{params_string(params)}",'Get', true, {}).json
14
+ end
15
+
16
+ def params_string(params)
17
+ arr = []
18
+ params.keys.each do |key|
19
+ arr << "#{key}=#{params[key]}" if Megavats::History::AVAILABLE_PARAMS.include?(key)
20
+ end
21
+ arr.size > 0 ? "?#{arr.join('&')}" : ''
11
22
  end
12
23
 
13
24
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Megavats
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: megavats
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mihail Kolebaev