dublin_bikes 0.0.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.
data/.gitignore ADDED
@@ -0,0 +1,19 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ Session.vim
19
+ .DS_Store
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in dublin_bikes.gemspec
4
+ gemspec
data/Guardfile ADDED
@@ -0,0 +1,6 @@
1
+ guard 'rspec' do
2
+ watch(%r{^spec/.+_spec\.rb$})
3
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
4
+ watch('spec/spec_helper.rb') { "spec" }
5
+ end
6
+
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Kevin Fagan
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # DublinBikes
2
+
3
+ A simple ruby wrapper around the (unofficial) dublin bikes api
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'dublin_bikes'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install dublin_bikes
18
+
19
+ ## Usage
20
+
21
+ ```ruby
22
+
23
+ # instantiate the client
24
+ db = DublinBikes.new
25
+
26
+ # get a list of stations
27
+ db.stations
28
+
29
+ # get a list of stations ordered by location
30
+ db.stations_closest_to(53.344304, -6.250427)
31
+
32
+ # check the status of a particular station by passing in its id
33
+ db.station_status(1)
34
+
35
+ ```
36
+
37
+ ## Contributing
38
+
39
+ 1. Fork it
40
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
41
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
42
+ 4. Push to the branch (`git push origin my-new-feature`)
43
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,31 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'dublin_bikes/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "dublin_bikes"
8
+ spec.version = DublinBikes::VERSION
9
+ spec.authors = ["Kevin Fagan"]
10
+ spec.email = ["kevin@tinktank.ie"]
11
+ spec.description = %q{Dublin Bikes gem}
12
+ spec.summary = %q{A simple ruby wrapper around the dublin bikes api}
13
+ spec.homepage = "https://github.com/kjf/dublin_bikes"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency 'faraday'
22
+ spec.add_dependency 'nokogiri-happymapper'
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.3"
25
+ spec.add_development_dependency "rake"
26
+ spec.add_development_dependency 'rspec'
27
+ spec.add_development_dependency 'webmock'
28
+ spec.add_development_dependency 'pry'
29
+ spec.add_development_dependency 'guard-rspec'
30
+ spec.add_development_dependency 'rb-fsevent', '~> 0.9.1'
31
+ end
@@ -0,0 +1,15 @@
1
+ require 'dublin_bikes/version'
2
+ require 'dublin_bikes/client'
3
+ require 'dublin_bikes/api_marker_list'
4
+ require 'dublin_bikes/api_marker'
5
+ require 'dublin_bikes/api_station'
6
+ require 'dublin_bikes/station'
7
+ require 'dublin_bikes/station_status'
8
+
9
+ module DublinBikes
10
+ class << self
11
+ def new
12
+ DublinBikes::Client.new
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,14 @@
1
+ module DublinBikes
2
+ class ApiMarker
3
+ include HappyMapper
4
+ tag 'marker'
5
+ attribute :name, String
6
+ attribute :number, Integer
7
+ attribute :address, String
8
+ attribute :full_address, String, tag: 'fullAddress'
9
+ attribute :lat, Float
10
+ attribute :lng, Float
11
+ attribute :open, Integer
12
+ attribute :bonus, Integer
13
+ end
14
+ end
@@ -0,0 +1,10 @@
1
+ require 'happymapper'
2
+ require 'dublin_bikes/api_marker'
3
+
4
+ module DublinBikes
5
+ class ApiMarkerList
6
+ include HappyMapper
7
+ tag 'markers'
8
+ has_many :markers, DublinBikes::ApiMarker
9
+ end
10
+ end
@@ -0,0 +1,15 @@
1
+ require 'happymapper'
2
+
3
+ module DublinBikes
4
+ class ApiStation
5
+ include HappyMapper
6
+ tag 'station'
7
+ element :available, Integer
8
+ element :free, Integer
9
+ element :total, Integer
10
+ element :ticket, Integer
11
+ element :open, Integer
12
+ element :updated, Integer
13
+ element :connected, Integer
14
+ end
15
+ end
@@ -0,0 +1,11 @@
1
+ require 'dublin_bikes/connection'
2
+ require 'dublin_bikes/client/stations'
3
+ require 'dublin_bikes/client/station_status'
4
+
5
+ module DublinBikes
6
+ class Client
7
+ include DublinBikes::Connection
8
+ include DublinBikes::Client::Stations
9
+ include DublinBikes::Client::StationStatus
10
+ end
11
+ end
@@ -0,0 +1,12 @@
1
+ module DublinBikes
2
+ class Client
3
+ module StationStatus
4
+ def station_status(id)
5
+ response = get("stationdetails/dublin/#{id}")
6
+ payload = response.body
7
+ station = DublinBikes::ApiStation.parse(payload)
8
+ status = DublinBikes::StationStatus.new(station)
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,20 @@
1
+ module DublinBikes
2
+ class Client
3
+ module Stations
4
+ def stations
5
+ @_stations ||= begin
6
+ response = get('carto')
7
+ payload = response.body
8
+ marker_list = DublinBikes::ApiMarkerList.parse(payload, single: true)
9
+ marker_list.markers.map do |marker|
10
+ DublinBikes::Station.new(marker)
11
+ end
12
+ end
13
+ end
14
+
15
+ def stations_closest_to(lat, lng)
16
+ stations.sort_by { |station| station.distance_to(lat, lng) }
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,17 @@
1
+ require 'faraday'
2
+
3
+ module DublinBikes
4
+ module Connection
5
+ def get(path)
6
+ connection.get(path)
7
+ end
8
+
9
+ private
10
+
11
+ def connection
12
+ Faraday.new(url: 'http://www.dublinbikes.ie/service') do |faraday|
13
+ faraday.adapter :net_http
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,31 @@
1
+ module DublinBikes
2
+ class Station
3
+ attr_reader :id, :address, :latitude, :longitude
4
+
5
+ def initialize(marker)
6
+ @id = marker.number
7
+ @address = marker.address
8
+ @latitude = marker.lat
9
+ @longitude = marker.lng
10
+ end
11
+
12
+ def distance_to(m_lat, m_lng)
13
+ d_lat = (@latitude - m_lat).to_rad
14
+ d_lng = (@longitude - m_lng).to_rad
15
+
16
+ a = Math.sin(d_lat / 2) * Math.sin(d_lat / 2) +
17
+ Math.cos(m_lat.to_rad) * Math.cos(@latitude.to_rad) *
18
+ Math.sin(d_lng / 2) * Math.sin(d_lng / 2)
19
+
20
+ c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a))
21
+
22
+ 6371 * c
23
+ end
24
+ end
25
+ end
26
+
27
+ class Numeric
28
+ def to_rad
29
+ self * Math::PI / 180
30
+ end
31
+ end
@@ -0,0 +1,26 @@
1
+ module DublinBikes
2
+ class StationStatus
3
+ attr_reader :available_bikes, :free_spaces, :total_capacity, :updated_at
4
+
5
+ def initialize(station)
6
+ @available_bikes = station.available
7
+ @free_spaces = station.free
8
+ @total_capacity = station.total
9
+ @open = station.open == 1 ? true : false
10
+ @accepts_credit_card = station.ticket == 1 ? true : false
11
+ @updated_at = Time.at(station.updated)
12
+ end
13
+
14
+ def open?
15
+ @open
16
+ end
17
+
18
+ def closed?
19
+ !open?
20
+ end
21
+
22
+ def accepts_credit_card?
23
+ @accepts_credit_card
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,3 @@
1
+ module DublinBikes
2
+ VERSION = "0.0.1"
3
+ end
data/main.rb ADDED
@@ -0,0 +1,9 @@
1
+ $: << File.expand_path(File.join(File.dirname(__FILE__), 'lib'))
2
+
3
+ require 'dublin_bikes'
4
+ require 'pry'
5
+
6
+ db = DublinBikes.new
7
+ p db.stations
8
+ p db.stations_closest_to(53.344304, -6.250427)
9
+ p db.station_status 1
@@ -0,0 +1,14 @@
1
+ require 'spec_helper'
2
+
3
+ describe DublinBikes::Client::StationStatus do
4
+ before do
5
+ @client = DublinBikes.new
6
+ end
7
+
8
+ it "gets a single station" do
9
+ stub_request(:get, /.*stationdetails\/dublin.*/).
10
+ to_return(body: File.open('spec/fixtures/station.xml'))
11
+
12
+ @client.station_status(1).should be_a DublinBikes::StationStatus
13
+ end
14
+ end
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe DublinBikes::Client::Stations do
4
+ before do
5
+ stub_request(:get, /.*carto$/).
6
+ to_return(body: File.open('spec/fixtures/markers.xml'))
7
+
8
+ @client = DublinBikes.new
9
+ end
10
+
11
+ it "gets a list of stations" do
12
+ @client.stations.should be_a Array
13
+ @client.stations.first.should be_a DublinBikes::Station
14
+ end
15
+
16
+ it "gets a list of stations closest to location" do
17
+ @client.stations_closest_to(53.344304, -6.250427).should be_a Array
18
+ @client.stations_closest_to(53.344304, -6.250427).first.id.should == 32
19
+ @client.stations_closest_to(53.344304, -6.250427).last.id.should == 12
20
+ end
21
+ end
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+
3
+ describe DublinBikes do
4
+ it "delegates to DublinBikes::Client" do
5
+ DublinBikes.new.should be_a DublinBikes::Client
6
+ end
7
+ end
@@ -0,0 +1,52 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <carto>
3
+ <markers>
4
+ <marker name="MERRION SQUARE EAST" number="25" address="Merrion Square East" fullAddress="Merrion Square East " lat="53.339434" lng="-6.246548" open="1" bonus="0"/>
5
+ <marker name="MERRION SQUARE WEST" number="26" address="Merrion Square West" fullAddress="Merrion Square West " lat="53.339764" lng="-6.251988" open="1" bonus="0"/>
6
+ <marker name="MOLESWORTH STREET" number="27" address="Molesworth Street" fullAddress="Molesworth Street " lat="53.341288" lng="-6.258117" open="1" bonus="0"/>
7
+ <marker name="MOUNTJOY SQUARE WEST" number="28" address="Mountjoy Square West" fullAddress="Mountjoy Square West " lat="53.356299" lng="-6.258586" open="1" bonus="0"/>
8
+ <marker name="ORMOND QUAY UPPER" number="29" address="Ormond Quay Upper" fullAddress="Ormond Quay Upper " lat="53.346057" lng="-6.268001" open="1" bonus="0"/>
9
+ <marker name="PARNELL SQUARE NORTH" number="30" address="Parnell Square North" fullAddress="Parnell Square North " lat="53.353462" lng="-6.265305" open="1" bonus="0"/>
10
+ <marker name="BOLTON STREET" number="3" address="Bolton Street" fullAddress="Bolton Street " lat="53.351182" lng="-6.269859" open="1" bonus="0"/>
11
+ <marker name="CATHAL BRUGHA STREET" number="24" address="Cathal Brugha Street" fullAddress="Cathal Brugha Street " lat="53.352149" lng="-6.260533" open="1" bonus="0"/>
12
+ <marker name="PARNELL STREET" number="31" address="Parnell Street" fullAddress="Parnell Street " lat="53.350929" lng="-6.265125" open="1" bonus="0"/>
13
+ <marker name="PEARSE STREET" number="32" address="Pearse Street" fullAddress="Pearse Street " lat="53.344304" lng="-6.250427" open="1" bonus="0"/>
14
+ <marker name="GREEK STREET" number="4" address="Greek Street" fullAddress="Greek Street " lat="53.346874" lng="-6.272976" open="1" bonus="0"/>
15
+ <marker name="CHARLEMONT PLACE" number="5" address="Charlemont Street" fullAddress="Charlemont Street " lat="53.330662" lng="-6.260177" open="1" bonus="0"/>
16
+ <marker name="HIGH STREET" number="7" address="High Street" fullAddress="High Street " lat="53.343565" lng="-6.275071" open="1" bonus="0"/>
17
+ <marker name="PORTOBELLO HARBOUR" number="34" address="Portobello Harbour" fullAddress="Portobello Harbour " lat="53.330362" lng="-6.265163" open="1" bonus="0"/>
18
+ <marker name="SMITHFIELD" number="35" address="Smithfield" fullAddress="Smithfield " lat="53.347692" lng="-6.278214" open="1" bonus="0"/>
19
+ <marker name="CUSTOM HOUSE QUAY" number="8" address="Custom House Quay" fullAddress="Custom House Quay " lat="53.347884" lng="-6.248048" open="1" bonus="0"/>
20
+ <marker name="ST. STEPHEN'S GREEN EAST" number="36" address="St. Stephen's Green East" fullAddress="St. Stephen's Green East " lat="53.337824" lng="-6.256035" open="1" bonus="0"/>
21
+ <marker name="EXCHEQUER STREET" number="9" address="Exchequer Street" fullAddress="Exchequer Street " lat="53.343034" lng="-6.263578" open="1" bonus="0"/>
22
+ <marker name="DAME STREET" number="10" address="Dame Street" fullAddress="Dame Street " lat="53.344007" lng="-6.266802" open="1" bonus="0"/>
23
+ <marker name="EARLSFORT TERRACE" number="11" address="Earlsfort Terrace" fullAddress="Earlsfort Terrace " lat="53.334019" lng="-6.258371" open="1" bonus="0"/>
24
+ <marker name="ECCLES STREET" number="12" address="Eccles Street" fullAddress="Eccles Street " lat="53.359246" lng="-6.269779" open="1" bonus="0"/>
25
+ <marker name="FITZWILLIAM SQUARE WEST" number="13" address="Fitzwilliam Square West" fullAddress="Fitzwilliam Square West " lat="53.336074" lng="-6.252825" open="1" bonus="0"/>
26
+ <marker name="FOWNES STREET UPPER" number="14" address="Fownes Street Upper" fullAddress="Fownes Street Upper " lat="53.344603" lng="-6.263371" open="1" bonus="0"/>
27
+ <marker name="ST. STEPHEN'S GREEN SOUTH" number="37" address="St. Stephen's Green South" fullAddress="St. Stephen's Green South " lat="53.337494" lng="-6.26199" open="1" bonus="0"/>
28
+ <marker name="TALBOT STREET" number="38" address="Talbot Street" fullAddress="Talbot Street " lat="53.350974" lng="-6.25294" open="1" bonus="0"/>
29
+ <marker name="GEORGES QUAY" number="16" address="Georges Quay" fullAddress="Georges Quay " lat="53.347508" lng="-6.252192" open="1" bonus="0"/>
30
+ <marker name="WILTON TERRACE" number="39" address="Wilton Terrace" fullAddress="Wilton Terrace " lat="53.332383" lng="-6.252717" open="1" bonus="0"/>
31
+ <marker name="JERVIS STREET" number="40" address="Jervis Street" fullAddress="Jervis Street " lat="53.3483" lng="-6.266651" open="1" bonus="0"/>
32
+ <marker name="SMITHFIELD NORTH" number="42" address="Smithfield North" fullAddress="Smithfield North " lat="53.349562" lng="-6.278198" open="1" bonus="0"/>
33
+ <marker name="PORTOBELLO ROAD" number="43" address="Portobello Road" fullAddress="Portobello Road " lat="53.330091" lng="-6.268044" open="1" bonus="0"/>
34
+ <marker name="UPPER SHERRARD STREET" number="44" address="Upper Sherrard Street" fullAddress="Upper Sherrard Street " lat="53.358437" lng="-6.260641" open="1" bonus="0"/>
35
+ <marker name="JAMES STREET EAST" number="20" address="James Street East" fullAddress="James Street East " lat="53.336485" lng="-6.248174" open="1" bonus="0"/>
36
+ <marker name="CUSTOM HOUSE" number="23" address="Custom House" fullAddress="Custom House " lat="53.348279" lng="-6.254662" open="1" bonus="0"/>
37
+ <marker name="LEINSTER STREET SOUTH" number="21" address="Leinster Street South" fullAddress="Leinster Street South " lat="53.34218" lng="-6.254485" open="1" bonus="0"/>
38
+ <marker name="TOWNSEND STREET" number="22" address="Townsend Street" fullAddress="Townsend Street " lat="53.345922" lng="-6.254614" open="1" bonus="0"/>
39
+ <marker name="HARCOURT TERRACE" number="41" address="Harcourt Terrace" fullAddress="Harcourt Terrace " lat="53.332763" lng="-6.257942" open="1" bonus="0"/>
40
+ <marker name="BLESSINGTON STREET" number="2" address="Blessington Street" fullAddress="Blessington Street " lat="53.356769" lng="-6.26814" open="1" bonus="0"/>
41
+ <marker name="CHRISTCHURCH PLACE" number="6" address="Christchurch Place" fullAddress="Christchurch Place " lat="53.343368" lng="-6.27012" open="1" bonus="0"/>
42
+ <marker name="HERBERT PLACE" number="19" address="Herbert Place" fullAddress="Herbert Place " lat="53.334432" lng="-6.245575" open="1" bonus="0"/>
43
+ <marker name="CHATHAM STREET" number="1" address="Chatham Street" fullAddress="Chatham Street " lat="53.340962" lng="-6.262287" open="1" bonus="0"/>
44
+ <marker name="GRANTHAM STREET" number="18" address="Grantham Street" fullAddress="Grantham Street " lat="53.334123" lng="-6.265436" open="1" bonus="0"/>
45
+ <marker name="HARDWICKE STREET" number="15" address="Hardwicke Street" fullAddress="Hardwicke Street " lat="53.355473" lng="-6.264423" open="1" bonus="0"/>
46
+ <marker name="GOLDEN LANE" number="17" address="Golden Lane" fullAddress="Golden Lane " lat="53.340803" lng="-6.267732" open="1" bonus="0"/>
47
+ <marker name="PRINCES STREET / O'CONNELL STREET" number="33" address="Princes Street / O'Connell Street" fullAddress="Princes Street / O'Connell Street " lat="53.349013" lng="-6.260311" open="1" bonus="0"/>
48
+ </markers>
49
+ <arrondissements>
50
+ <arrondissement number="0" minLat="53.330091" minLng="-6.278214" maxLat="53.359246" maxLng="-6.245575"/>
51
+ </arrondissements>
52
+ </carto>
@@ -0,0 +1,10 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <station>
3
+ <available>3</available>
4
+ <free>26</free>
5
+ <total>29</total>
6
+ <ticket>1</ticket>
7
+ <open>1</open>
8
+ <updated>1366310525</updated>
9
+ <connected>1</connected>
10
+ </station>
@@ -0,0 +1,15 @@
1
+ require 'dublin_bikes'
2
+ require 'webmock/rspec'
3
+
4
+ RSpec.configure do |config|
5
+ config.treat_symbols_as_metadata_keys_with_true_values = true
6
+ config.run_all_when_everything_filtered = true
7
+ config.filter_run :focus
8
+ config.color_enabled = true
9
+
10
+ # Run specs in random order to surface order dependencies. If you find an
11
+ # order dependency and want to debug it, you can fix the order by providing
12
+ # the seed, which is printed after each run.
13
+ # --seed 1234
14
+ config.order = 'random'
15
+ end
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ describe DublinBikes::Station do
4
+ before do
5
+ marker_list = DublinBikes::ApiMarkerList.parse(File.open('spec/fixtures/markers.xml'),
6
+ single: true)
7
+ @marker = marker_list.markers.first
8
+ end
9
+
10
+ it "instantiates using via api_marker" do
11
+ station = DublinBikes::Station.new(@marker)
12
+ station.id.should == 25
13
+ station.address.should == 'Merrion Square East'
14
+ station.latitude.should == 53.339434
15
+ station.longitude.should == -6.246548
16
+ end
17
+ end
@@ -0,0 +1,36 @@
1
+ require 'spec_helper'
2
+
3
+ describe DublinBikes::StationStatus do
4
+ before do
5
+ station = DublinBikes::ApiStation.parse(File.open('spec/fixtures/station.xml'))
6
+ @status = DublinBikes::StationStatus.new(station)
7
+ end
8
+
9
+ it "has available bikes" do
10
+ @status.available_bikes.should == 3
11
+ end
12
+
13
+ it "accepts credit cards" do
14
+ @status.accepts_credit_card?.should be_true
15
+ end
16
+
17
+ it "has a total capacity" do
18
+ @status.total_capacity.should == 29
19
+ end
20
+
21
+ it "has a number of free spaces" do
22
+ @status.free_spaces.should == 26
23
+ end
24
+
25
+ it "is open" do
26
+ @status.open?.should be_true
27
+ end
28
+
29
+ it "is not closed" do
30
+ @status.closed?.should be_false
31
+ end
32
+
33
+ it "has an updated at time" do
34
+ @status.updated_at.should be_a Time
35
+ end
36
+ end
metadata ADDED
@@ -0,0 +1,226 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dublin_bikes
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Kevin Fagan
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-04-21 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: faraday
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: nokogiri-happymapper
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: bundler
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: '1.3'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '1.3'
62
+ - !ruby/object:Gem::Dependency
63
+ name: rake
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: rspec
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: webmock
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: pry
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: guard-rspec
128
+ requirement: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ! '>='
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ type: :development
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ - !ruby/object:Gem::Dependency
143
+ name: rb-fsevent
144
+ requirement: !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ~>
148
+ - !ruby/object:Gem::Version
149
+ version: 0.9.1
150
+ type: :development
151
+ prerelease: false
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ~>
156
+ - !ruby/object:Gem::Version
157
+ version: 0.9.1
158
+ description: Dublin Bikes gem
159
+ email:
160
+ - kevin@tinktank.ie
161
+ executables: []
162
+ extensions: []
163
+ extra_rdoc_files: []
164
+ files:
165
+ - .gitignore
166
+ - Gemfile
167
+ - Guardfile
168
+ - LICENSE.txt
169
+ - README.md
170
+ - Rakefile
171
+ - dublin_bikes.gemspec
172
+ - lib/dublin_bikes.rb
173
+ - lib/dublin_bikes/api_marker.rb
174
+ - lib/dublin_bikes/api_marker_list.rb
175
+ - lib/dublin_bikes/api_station.rb
176
+ - lib/dublin_bikes/client.rb
177
+ - lib/dublin_bikes/client/station_status.rb
178
+ - lib/dublin_bikes/client/stations.rb
179
+ - lib/dublin_bikes/connection.rb
180
+ - lib/dublin_bikes/station.rb
181
+ - lib/dublin_bikes/station_status.rb
182
+ - lib/dublin_bikes/version.rb
183
+ - main.rb
184
+ - spec/client/station_status_spec.rb
185
+ - spec/client/stations_spec.rb
186
+ - spec/dublin_bikes_spec.rb
187
+ - spec/fixtures/markers.xml
188
+ - spec/fixtures/station.xml
189
+ - spec/spec_helper.rb
190
+ - spec/station_spec.rb
191
+ - spec/station_status_spec.rb
192
+ homepage: https://github.com/kjf/dublin_bikes
193
+ licenses:
194
+ - MIT
195
+ post_install_message:
196
+ rdoc_options: []
197
+ require_paths:
198
+ - lib
199
+ required_ruby_version: !ruby/object:Gem::Requirement
200
+ none: false
201
+ requirements:
202
+ - - ! '>='
203
+ - !ruby/object:Gem::Version
204
+ version: '0'
205
+ required_rubygems_version: !ruby/object:Gem::Requirement
206
+ none: false
207
+ requirements:
208
+ - - ! '>='
209
+ - !ruby/object:Gem::Version
210
+ version: '0'
211
+ requirements: []
212
+ rubyforge_project:
213
+ rubygems_version: 1.8.25
214
+ signing_key:
215
+ specification_version: 3
216
+ summary: A simple ruby wrapper around the dublin bikes api
217
+ test_files:
218
+ - spec/client/station_status_spec.rb
219
+ - spec/client/stations_spec.rb
220
+ - spec/dublin_bikes_spec.rb
221
+ - spec/fixtures/markers.xml
222
+ - spec/fixtures/station.xml
223
+ - spec/spec_helper.rb
224
+ - spec/station_spec.rb
225
+ - spec/station_status_spec.rb
226
+ has_rdoc: