tfl 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.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.rspec +2 -0
- data/.travis.yml +16 -0
- data/Gemfile +4 -0
- data/Guardfile +6 -0
- data/LICENSE.txt +22 -0
- data/README.md +54 -0
- data/Rakefile +7 -0
- data/lib/tfl.rb +9 -0
- data/lib/tfl/client.rb +20 -0
- data/lib/tfl/version.rb +3 -0
- data/spec/lib/tfl/client_spec.rb +35 -0
- data/spec/lib/tfl_spec.rb +4 -0
- data/spec/spec_helper.rb +10 -0
- data/tfl.gemspec +27 -0
- metadata +146 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0a8be7fa4bcb821f7d5addd739df7261448a5346
|
4
|
+
data.tar.gz: 4e530947418340948141df6c5e495663efc90cfa
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0a3109ee34f8813e43e802799746d80424d6fdf7ca96ffc5f19093b0eea6fe3b1dafe9286d07755a894a8e6fa9632848b2ba29e56004e5579a13e22c9b644ff3
|
7
|
+
data.tar.gz: fe314c4d8aca0c87ac0ee2bbd671f95f93e49179d9dfd0df54d21bbb8d84332db5b72b3763b38e79bcfb69721159d8f786a05f9783d8b303fa7410c4122b3d3b
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Guardfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Samuel Molinari
|
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,54 @@
|
|
1
|
+
# Tfl Gem
|
2
|
+
|
3
|
+
[](https://travis-ci.org/samuelmolinari/tfl)
|
4
|
+
[](http://badge.fury.io/rb/tfl)
|
5
|
+
[](https://codeclimate.com/github/samuelmolinari/tfl)
|
6
|
+
[](https://codeclimate.com/github/samuelmolinari/tfl)
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
Add this line to your application's Gemfile:
|
11
|
+
|
12
|
+
gem 'tfl'
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
$ bundle
|
17
|
+
|
18
|
+
Or install it yourself as:
|
19
|
+
|
20
|
+
$ gem install tfl
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
### Configure client
|
25
|
+
|
26
|
+
In order to use the Tfl API, you have to setup your credentials.
|
27
|
+
|
28
|
+
#### The block way
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
client = Tfl::Client.new do |config|
|
32
|
+
config.app_id = "...",
|
33
|
+
config.app_key = "..."
|
34
|
+
end
|
35
|
+
```
|
36
|
+
|
37
|
+
#### The hash way
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
credientials = {
|
41
|
+
:app_id => "...",
|
42
|
+
:app_key => "..."
|
43
|
+
}
|
44
|
+
|
45
|
+
client = Tfl::Client.new(credentials)
|
46
|
+
```
|
47
|
+
|
48
|
+
## Contributing
|
49
|
+
|
50
|
+
1. Fork it
|
51
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
52
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
53
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
54
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/lib/tfl.rb
ADDED
data/lib/tfl/client.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
class ::Tfl::Client
|
2
|
+
|
3
|
+
attr_accessor :app_id, :app_key
|
4
|
+
|
5
|
+
def initialize(options = {})
|
6
|
+
options.each do |key,value|
|
7
|
+
instance_variable_set("@#{key}", value)
|
8
|
+
end
|
9
|
+
|
10
|
+
yield(self) if block_given?
|
11
|
+
end
|
12
|
+
|
13
|
+
def credentials
|
14
|
+
{
|
15
|
+
app_id: @app_id,
|
16
|
+
app_key: @app_key
|
17
|
+
}
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
data/lib/tfl/version.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ::Tfl::Client do
|
4
|
+
|
5
|
+
let(:app_id) { 'my app id' }
|
6
|
+
let(:app_key) { 'my app key' }
|
7
|
+
|
8
|
+
let(:client) { described_class.new(app_id: app_id, app_key: app_key) }
|
9
|
+
|
10
|
+
context 'when initialized with block' do
|
11
|
+
subject(:client) do
|
12
|
+
described_class.new do |config|
|
13
|
+
config.app_id = app_id
|
14
|
+
config.app_key = app_key
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
it { is_expected.to have_attributes(:app_id => app_id,
|
19
|
+
:app_key => app_key) }
|
20
|
+
end
|
21
|
+
|
22
|
+
context 'when initialized with hash' do
|
23
|
+
subject(:client) { described_class.new(app_id: app_id, app_key: app_key) }
|
24
|
+
|
25
|
+
it { is_expected.to have_attributes(:app_id => app_id,
|
26
|
+
:app_key => app_key) }
|
27
|
+
end
|
28
|
+
|
29
|
+
describe '#credentials' do
|
30
|
+
it 'returns a hash' do
|
31
|
+
expect(client.credentials).to eq({:app_id => app_id, :app_key => app_key})
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
data/spec/spec_helper.rb
ADDED
data/tfl.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'tfl/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "tfl"
|
8
|
+
spec.version = Tfl::VERSION
|
9
|
+
spec.authors = ["Samuel Molinari"]
|
10
|
+
spec.email = ["samuel@molinari.me"]
|
11
|
+
spec.description = %q{Ruby Tfl API}
|
12
|
+
spec.summary = %q{Ruby interface to access most of the APIs provided by the Tfl}
|
13
|
+
spec.homepage = ""
|
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_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "rspec"
|
24
|
+
spec.add_development_dependency "guard"
|
25
|
+
spec.add_development_dependency "guard-rspec"
|
26
|
+
spec.add_development_dependency "codeclimate-test-reporter"
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tfl
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Samuel Molinari
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-11-20 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: guard
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: guard-rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: codeclimate-test-reporter
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: Ruby Tfl API
|
98
|
+
email:
|
99
|
+
- samuel@molinari.me
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- .gitignore
|
105
|
+
- .rspec
|
106
|
+
- .travis.yml
|
107
|
+
- Gemfile
|
108
|
+
- Guardfile
|
109
|
+
- LICENSE.txt
|
110
|
+
- README.md
|
111
|
+
- Rakefile
|
112
|
+
- lib/tfl.rb
|
113
|
+
- lib/tfl/client.rb
|
114
|
+
- lib/tfl/version.rb
|
115
|
+
- spec/lib/tfl/client_spec.rb
|
116
|
+
- spec/lib/tfl_spec.rb
|
117
|
+
- spec/spec_helper.rb
|
118
|
+
- tfl.gemspec
|
119
|
+
homepage: ''
|
120
|
+
licenses:
|
121
|
+
- MIT
|
122
|
+
metadata: {}
|
123
|
+
post_install_message:
|
124
|
+
rdoc_options: []
|
125
|
+
require_paths:
|
126
|
+
- lib
|
127
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
133
|
+
requirements:
|
134
|
+
- - '>='
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: '0'
|
137
|
+
requirements: []
|
138
|
+
rubyforge_project:
|
139
|
+
rubygems_version: 2.0.6
|
140
|
+
signing_key:
|
141
|
+
specification_version: 4
|
142
|
+
summary: Ruby interface to access most of the APIs provided by the Tfl
|
143
|
+
test_files:
|
144
|
+
- spec/lib/tfl/client_spec.rb
|
145
|
+
- spec/lib/tfl_spec.rb
|
146
|
+
- spec/spec_helper.rb
|