glide 0.0.1 → 0.0.2

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.
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # Glide
2
2
 
3
- The glide gem is a simple wrapper around the Glide UK api to retrieve quotes for the individual services you require in one go and sum up the totals.
3
+ The glide gem is a simple wrapper around the [Glide UK][glide] api to retrieve quotes for the individual services you require in one go and sum up the totals.
4
+
5
+ [glide]: http://www.glide.uk.com/
4
6
 
5
7
  # Installation
6
8
 
@@ -40,6 +42,7 @@ that includes a stack trace and any details that may be necessary to reproduce
40
42
  the bug, including your gem version, Ruby version, and operating system.
41
43
  Ideally, a bug report should include a pull request with failing specs.
42
44
 
45
+ [issues]: https://github.com/vpacher/glide/issues
43
46
  [gist]: https://gist.github.com/
44
47
 
45
48
  # Submitting a Pull Request
data/lib/glide.rb CHANGED
@@ -4,7 +4,6 @@ require 'httparty'
4
4
  require 'json'
5
5
 
6
6
  module Glide
7
-
8
7
  @@api_key = ""
9
8
 
10
9
  def self.api_key
@@ -15,7 +14,7 @@ module Glide
15
14
  @@api_key = key
16
15
  end
17
16
 
18
- def self.get_qote(services = ['elec'], extra = {}, period = 6, tenants = 1)
17
+ def self.get_quote(services = ['elec'], extra = {}, period = 6, tenants = 1)
19
18
  quotes = {}
20
19
  services.each do |service|
21
20
  quotes[service] = get_service_quote(service, extra[service], period, tenants)
@@ -37,7 +36,7 @@ module Glide
37
36
  quotes["total"]["tenant_week"] = quotes.map { |e| e[1]["tenant_week"].to_f }.reduce(:+).to_s
38
37
  quotes["total"]["tenant_month"] = quotes.map { |e| e[1]["tenant_month"].to_f }.reduce(:+).to_s
39
38
  quotes["total"]["monthly_fee"] = quotes.map { |e| e[1]["monthly_fee"].to_f }.reduce(:+).to_s
40
-
39
+
41
40
  quotes
42
41
  end
43
42
  end
data/lib/glide/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Glide
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/spec/glide_spec.rb CHANGED
@@ -13,7 +13,7 @@ describe Glide do
13
13
 
14
14
  it 'should return a hash' do
15
15
  HTTParty.should_receive(:get).exactly(6).times.and_return(Marshal.load("\004\bo:\027HTTParty::Response\n:\r@headerso: HTTParty::Response::Headers\006:\f@header{\017\"\vserver[\006\"\vApache\"\tdate[\006\"\"Sun, 06 May 2012 16:19:40 GMT\"\fexpires[\006\"\"Thu, 19 Nov 1981 08:52:00 GMT\"\vpragma[\006\"\rno-cache\"\023content-length[\006\"\b113\"\021content-type[\006\"\025application/json\"\017connection[\006\"\nclose\"\017set-cookie[\a\"9symfony=2n594frr1c83aldiloljk7erq3; path=/; HttpOnly\"9symfony=6pvq9hfd8elj5n8j2m5ij9kkp7; path=/; HttpOnly\"\022cache-control[\006\"\rno-cache\"\vx-farm[\006\"\nHTTPS:\025@parsed_response{\a\"\fversion\"\rv3.1.1.5\"\fresults{\t\"\020monthly_fee\"\n30.20\"\020tenant_week\"\t6.97\"\nnotes0\"\021tenant_month\"\n30.20:\r@requesto:\026HTTParty::Request\v:\016@last_urio:\017URI::HTTPS\017:\016@fragment0:\n@porti\002\273\001:\n@path\"\036/signup/servicePrice.json:\016@registry0:\016@password0:\f@opaque0:\n@user0:\v@query\"\002/\001key=1O3N6dk0jENDVGIO44WDUbLT7AIG8W6Z&period=6&extra=&service=elec&tenants=1&key=1O3N6dk0jENDVGIO44WDUbLT7AIG8W6Z&period=6&extra=&service=elec&tenants=1&key=1O3N6dk0jENDVGIO44WDUbLT7AIG8W6Z&period=6&extra=&service=elec&tenants=1&key=1O3N6dk0jENDVGIO44WDUbLT7AIG8W6Z&period=6&extra=&service=elec&tenants=1:\n@host\"\025api.glide.uk.com:\f@scheme\"\nhttps:\r@options{\n:\025follow_redirectsT:\023default_params{\000:\vparserc\025HTTParty::Parser:\nquery{\n:\bkey\"%1O3N6dk0jENDVGIO44WDUbLT7AIG8W6Z:\nextra0:\vperiodi\v:\fservice\"\telec:\ftenantsi\006:\nlimiti\n;\020@4:\021@raw_requesto:\023Net::HTTP::Get\f:\021@body_stream0;\020\"j/signup/servicePrice.json?key=1O3N6dk0jENDVGIO44WDUbLT7AIG8W6Z&period=6&extra=&service=elec&tenants=1:\n@body0;\b{\a\"\017connection[\006\"\nclose\"\thost[\006\"\025api.glide.uk.com:\027@response_has_bodyT:\026@request_has_bodyF:\f@method\"\bGET:\021@http_methodc\023Net::HTTP::Get:\023@last_responseo:\020Net::HTTPOK\r:\022@http_version\"\b1.1:\020@body_existT:\f@socket0;&\"v{\"results\":{\"monthly_fee\":\"30.20\",\"tenant_week\":\"6.97\",\"tenant_month\":\"30.20\",\"notes\":null},\"version\":\"v3.1.1.5\"};\b{\017@\b@\t@\024@\025@\021@\022@\016@\017@\v@\f@\027@\030@\032@\e@!@\"@\035@\036@$@%:\r@message\"\aOK:\n@code\"\b200:\n@readT;&@L:\016@response@J"))
16
- quotes = Glide.get_qote(services = ["elec", "water", "gas", "telephone", "broadband", "tv_license"])
16
+ quotes = Glide.get_quote(services = ["elec", "water", "gas", "telephone", "broadband", "tv_license"])
17
17
  quotes.should be_an_instance_of(Hash)
18
18
  quotes["elec"]["monthly_fee"].should eql("30.20")
19
19
  quotes["water"]["tenant_month"].should eql("30.20")
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glide
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Volker Pacher