glide 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/.rvmrc ADDED
@@ -0,0 +1,81 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # This is an RVM Project .rvmrc file, used to automatically load the ruby
4
+ # development environment upon cd'ing into the directory
5
+
6
+ # First we specify our desired <ruby>[@<gemset>], the @gemset name is optional.
7
+ environment_id="ruby-1.9.3-p0"
8
+
9
+ #
10
+ # Uncomment the following lines if you want to verify rvm version per project
11
+ #
12
+ # rvmrc_rvm_version="1.10.2" # 1.10.1 seams as a safe start
13
+ # eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || {
14
+ # echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading."
15
+ # return 1
16
+ # }
17
+ #
18
+
19
+ #
20
+ # Uncomment following line if you want options to be set only for given project.
21
+ #
22
+ # PROJECT_JRUBY_OPTS=( --1.9 )
23
+ #
24
+ # The variable PROJECT_JRUBY_OPTS requires the following to be run in shell:
25
+ #
26
+ # chmod +x ${rvm_path}/hooks/after_use_jruby_opts
27
+ #
28
+
29
+ #
30
+ # First we attempt to load the desired environment directly from the environment
31
+ # file. This is very fast and efficient compared to running through the entire
32
+ # CLI and selector. If you want feedback on which environment was used then
33
+ # insert the word 'use' after --create as this triggers verbose mode.
34
+ #
35
+ if [[ -d "${rvm_path:-$HOME/.rvm}/environments" \
36
+ && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
37
+ then
38
+ \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
39
+
40
+ if [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]]
41
+ then
42
+ . "${rvm_path:-$HOME/.rvm}/hooks/after_use"
43
+ fi
44
+ else
45
+ # If the environment file has not yet been created, use the RVM CLI to select.
46
+ if ! rvm --create "$environment_id"
47
+ then
48
+ echo "Failed to create RVM environment '${environment_id}'."
49
+ return 1
50
+ fi
51
+ fi
52
+
53
+ #
54
+ # If you use an RVM gemset file to install a list of gems (*.gems), you can have
55
+ # it be automatically loaded. Uncomment the following and adjust the filename if
56
+ # necessary.
57
+ #
58
+ # filename=".gems"
59
+ # if [[ -s "$filename" ]]
60
+ # then
61
+ # rvm gemset import "$filename" | grep -v already | grep -v listed | grep -v complete | sed '/^$/d'
62
+ # fi
63
+
64
+ # If you use bundler, this might be useful to you:
65
+ # if [[ -s Gemfile ]] && ! command -v bundle >/dev/null
66
+ # then
67
+ # printf "%b" "The rubygem 'bundler' is not installed. Installing it now.\n"
68
+ # gem install bundler
69
+ # fi
70
+ # if [[ -s Gemfile ]] && command -v bundle
71
+ # then
72
+ # bundle install
73
+ # fi
74
+
75
+ if [[ $- == *i* ]] # check for interactive shells
76
+ then
77
+ echo "Using: $(tput setaf 2)$GEM_HOME$(tput sgr0)" # show the user the ruby and gemset they are using in green
78
+ else
79
+ echo "Using: $GEM_HOME" # don't use colors in interactive shells
80
+ fi
81
+
data/.travis.yml ADDED
@@ -0,0 +1,12 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.8.7
4
+ - 1.9.2
5
+ - 1.9.3
6
+ - jruby-18mode
7
+ - jruby-19mode
8
+ - rbx-18mode
9
+ # - rbx-19mode
10
+ - ruby-head
11
+ - jruby-head
12
+ - ree
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
- # Glide
1
+ # Glide [![Build Status](https://secure.travis-ci.org/vpacher/glide.png?branch=master)](http://travis-ci.org/vpacher/glide) [![Dependency Status](https://gemnasium.com/vpacher/glide.png)](https://gemnasium.com/vpacher/glide)
2
+ =====
2
3
 
3
4
  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
 
@@ -30,9 +31,9 @@ where the paramaters are as follows:
30
31
 
31
32
  service: Can be one or any combination of elec, water, gas, telephone, broadband and tv_license
32
33
  extra: required additional information for certain services:
33
- for elec 'green', 'nogas' or 'green,nogas' is optional
34
- for water postcode is required
35
- for broadband llu24s for standard broadband or llu24p for premium broadband is required
34
+ * for elec 'green', 'nogas' or 'green,nogas' is optional
35
+ * for water postcode is required
36
+ * for broadband llu24s for standard broadband or llu24p for premium broadband is required
36
37
 
37
38
  # Submitting an Issue
38
39
  We use the [GitHub issue tracker][issues] to track bugs and features. Before
@@ -69,5 +70,3 @@ Copyright (c) 2012 Volker Pacher
69
70
  See [LICENSE][] for details.
70
71
 
71
72
  [license]: https://github.com/vpacher/glide/blob/master/LICENSE.md
72
-
73
- =====
data/Rakefile CHANGED
@@ -1 +1,10 @@
1
- require "bundler/gem_tasks"
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
3
+
4
+ require 'rspec/core/rake_task'
5
+ RSpec::Core::RakeTask.new(:spec) do |t|
6
+ t.rspec_opts = "--color --format doc"
7
+ end
8
+
9
+ task :test => :spec
10
+ task :default => :spec
data/lib/glide.rb CHANGED
@@ -4,10 +4,10 @@ require 'httparty'
4
4
  require 'json'
5
5
 
6
6
  module Glide
7
- @@api_key = ""
7
+ HUMAN_NAME = {"elec" => "Electricity", "tv_license" => "TV License"}
8
8
 
9
9
  def self.api_key
10
- @@api_key
10
+ @@api_key ||= ""
11
11
  end
12
12
 
13
13
  def self.api_key=(key)
@@ -18,6 +18,7 @@ module Glide
18
18
  quotes = {}
19
19
  services.each do |service|
20
20
  quotes[service] = get_service_quote(service, extra[service], period, tenants)
21
+ quotes[service]["human_name"] = insert_human_name(service)
21
22
  end
22
23
  calculate_totals(quotes)
23
24
  end
@@ -31,11 +32,15 @@ module Glide
31
32
  {"message" => "An error has occured", "error" => 3}
32
33
  end
33
34
 
35
+ def self.insert_human_name(service)
36
+ HUMAN_NAME[service] || service.capitalize
37
+ end
38
+
34
39
  def self.calculate_totals(quotes)
35
40
  quotes["total"] = {}
36
- quotes["total"]["tenant_week"] = "%.2f" % quotes.map { |e| e[1]["tenant_week"].to_f }.reduce(:+)
37
- quotes["total"]["tenant_month"] = "%.2f" % quotes.map { |e| e[1]["tenant_month"].to_f }.reduce(:+)
38
- quotes["total"]["monthly_fee"] = "%.2f" % quotes.map { |e| e[1]["monthly_fee"].to_f }.reduce(:+)
41
+ ["tenant_week", "tenant_month", "monthly_fee"].each do |k|
42
+ quotes["total"][k] = "%.2f" % quotes.map { |e| e[1][k].to_f }.reduce(:+)
43
+ end
39
44
 
40
45
  quotes
41
46
  end
data/lib/glide/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Glide
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/spec/glide_spec.rb CHANGED
@@ -3,7 +3,7 @@ require 'glide'
3
3
  describe Glide do
4
4
 
5
5
  # RESPONSE
6
- # "\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"
6
+ let(:response_elec) { 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") }
7
7
 
8
8
  before do
9
9
  Glide::api_key = "ABC"
@@ -11,10 +11,11 @@ describe Glide do
11
11
 
12
12
  describe "get_quote" do
13
13
 
14
- it 'should return a hash' do
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"))
14
+ it 'should return a hash filled with quotes and sum up totals' do
15
+ HTTParty.should_receive(:get).exactly(6).times.and_return(response_elec)
16
16
  quotes = Glide.get_quote(services = ["elec", "water", "gas", "telephone", "broadband", "tv_license"])
17
17
  quotes.should be_an_instance_of(Hash)
18
+ quotes["elec"]["human_name"].should be_an_instance_of(String)
18
19
  quotes["elec"]["monthly_fee"].should eql("30.20")
19
20
  quotes["water"]["tenant_month"].should eql("30.20")
20
21
  quotes["total"]["monthly_fee"].should eql("181.20")
@@ -27,11 +28,11 @@ describe Glide do
27
28
  describe "get_service_quote" do
28
29
 
29
30
  it 'should respond with HTTParty response and convert to json' do
30
- # HTTParty.should_receive(:get).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"))
31
- HTTParty.should_receive(:get) do |args|
32
- args[1][:query][:service].should eql("elec")
33
- 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")
34
- end
31
+ HTTParty.should_receive(:get).and_return(response_elec)
32
+ # HTTParty.should_receive(:get) do |args|
33
+ # args[1][:query][:service].should eql("elec")
34
+ # return response_elec
35
+ # end
35
36
  Glide.get_service_quote("elec", nil, 6, 1).should eql({"monthly_fee"=>"30.20", "tenant_week"=>"6.97", "notes"=>nil, "tenant_month"=>"30.20"})
36
37
  end
37
38
 
@@ -56,4 +57,15 @@ describe Glide do
56
57
  end
57
58
  end
58
59
 
60
+ describe "insert_human_name" do
61
+ it "should return the human readable name of the service" do
62
+ Glide.insert_human_name("elec").should eql("Electricity")
63
+ Glide.insert_human_name("water").should eql("Water")
64
+ Glide.insert_human_name("gas").should eql("Gas")
65
+ Glide.insert_human_name("telephone").should eql("Telephone")
66
+ Glide.insert_human_name("broadband").should eql("Broadband")
67
+ Glide.insert_human_name("tv_license").should eql("TV License")
68
+ end
69
+ end
70
+
59
71
  end
metadata CHANGED
@@ -1,89 +1,71 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: glide
3
- version: !ruby/object:Gem::Version
4
- hash: 25
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.4
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 3
10
- version: 0.0.3
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Volker Pacher
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-05-08 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
21
- version_requirements: &id001 !ruby/object:Gem::Requirement
22
- none: false
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- hash: 3
27
- segments:
28
- - 0
29
- version: "0"
30
- prerelease: false
31
- requirement: *id001
32
- type: :runtime
12
+ date: 2012-05-09 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
33
15
  name: httparty
34
- - !ruby/object:Gem::Dependency
35
- version_requirements: &id002 !ruby/object:Gem::Requirement
16
+ requirement: &16452180 !ruby/object:Gem::Requirement
36
17
  none: false
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- hash: 3
41
- segments:
42
- - 0
43
- version: "0"
44
- prerelease: false
45
- requirement: *id002
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
46
22
  type: :runtime
23
+ prerelease: false
24
+ version_requirements: *16452180
25
+ - !ruby/object:Gem::Dependency
47
26
  name: json
48
- - !ruby/object:Gem::Dependency
49
- version_requirements: &id003 !ruby/object:Gem::Requirement
27
+ requirement: &16451340 !ruby/object:Gem::Requirement
50
28
  none: false
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- hash: 3
55
- segments:
56
- - 0
57
- version: "0"
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
58
34
  prerelease: false
59
- requirement: *id003
60
- type: :development
35
+ version_requirements: *16451340
36
+ - !ruby/object:Gem::Dependency
61
37
  name: rake
62
- - !ruby/object:Gem::Dependency
63
- version_requirements: &id004 !ruby/object:Gem::Requirement
38
+ requirement: &16450440 !ruby/object:Gem::Requirement
64
39
  none: false
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- hash: 3
69
- segments:
70
- - 0
71
- version: "0"
72
- prerelease: false
73
- requirement: *id004
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
74
44
  type: :development
45
+ prerelease: false
46
+ version_requirements: *16450440
47
+ - !ruby/object:Gem::Dependency
75
48
  name: rspec
76
- description: allows you to get quotes from the glide api for the services required in one go and sum up the totals
77
- email:
49
+ requirement: &16449960 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *16449960
58
+ description: allows you to get quotes from the glide api for the services required
59
+ in one go and sum up the totals
60
+ email:
78
61
  - volker.pacher@gmail.com
79
62
  executables: []
80
-
81
63
  extensions: []
82
-
83
64
  extra_rdoc_files: []
84
-
85
- files:
65
+ files:
86
66
  - .gitignore
67
+ - .rvmrc
68
+ - .travis.yml
87
69
  - Gemfile
88
70
  - LICENSE.md
89
71
  - README.md
@@ -94,36 +76,32 @@ files:
94
76
  - spec/glide_spec.rb
95
77
  homepage: https://github.com/vpacher/glide
96
78
  licenses: []
97
-
98
79
  post_install_message:
99
80
  rdoc_options: []
100
-
101
- require_paths:
81
+ require_paths:
102
82
  - lib
103
- required_ruby_version: !ruby/object:Gem::Requirement
83
+ required_ruby_version: !ruby/object:Gem::Requirement
104
84
  none: false
105
- requirements:
106
- - - ">="
107
- - !ruby/object:Gem::Version
108
- hash: 3
109
- segments:
85
+ requirements:
86
+ - - ! '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ segments:
110
90
  - 0
111
- version: "0"
112
- required_rubygems_version: !ruby/object:Gem::Requirement
91
+ hash: 2390579026065632148
92
+ required_rubygems_version: !ruby/object:Gem::Requirement
113
93
  none: false
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- hash: 3
118
- segments:
94
+ requirements:
95
+ - - ! '>='
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ segments:
119
99
  - 0
120
- version: "0"
100
+ hash: 2390579026065632148
121
101
  requirements: []
122
-
123
102
  rubyforge_project: glide
124
103
  rubygems_version: 1.8.15
125
104
  signing_key:
126
105
  specification_version: 3
127
106
  summary: a wrapper of the Glide Uk api
128
107
  test_files: []
129
-