driver 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/driver.gemspec +2 -2
- data/lib/driver/api.rb +1 -1
- data/lib/driver/client.rb +8 -4
- metadata +3 -25
- data/APIClient.png +0 -0
- data/spec/driver_spec.rb +0 -25
- data/spec/dummy/bin/dummy +0 -11
- data/spec/dummy/lib/dummy/client/api/database.rb +0 -9
- data/spec/dummy/lib/dummy/client/api/table.rb +0 -9
- data/spec/dummy/lib/dummy/client/api.rb +0 -15
- data/spec/dummy/lib/dummy/client/database.rb +0 -9
- data/spec/dummy/lib/dummy/client/model/database.rb +0 -11
- data/spec/dummy/lib/dummy/client.rb +0 -14
- data/spec/dummy/lib/dummy.rb +0 -2
- data/spec/spec_helper.rb +0 -84
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16a546a1af3242718533322c30f6f874bf630a25
|
4
|
+
data.tar.gz: 78e06e8d34e281e4c35d4af25b58ffdade3d9f7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e1c825e26466fbbce8c6ccc4d65e23545360657db4d871710e2b5033effe82b997beec42cd7a77fd270d6a2c038459b96e4fc37412f8b88b4e58b3668688b36
|
7
|
+
data.tar.gz: f046d98f722409c20a28ed0559a78b17057674c66caf019ac49d1536cfcf40e6e5530220b4174cf48b7f838493eb46e82f3847f26586e215baeb75817d374645
|
data/driver.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "driver"
|
7
|
-
spec.version = "0.0.
|
7
|
+
spec.version = "0.0.2"
|
8
8
|
spec.authors = ["hiro-su"]
|
9
9
|
spec.email = ["h.sugipon@gmail.com"]
|
10
10
|
spec.summary = %q{Simple Framework for API Client.}
|
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.homepage = "https://github.com/hiro-su/driver"
|
13
13
|
spec.license = "MIT"
|
14
14
|
|
15
|
-
spec.files = `git ls-files -z`.split("\x0")
|
15
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|sample|APIClient\.png)}) }
|
16
16
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
17
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
18
|
spec.require_paths = ["lib"]
|
data/lib/driver/api.rb
CHANGED
data/lib/driver/client.rb
CHANGED
@@ -13,15 +13,19 @@ module Driver
|
|
13
13
|
# client
|
14
14
|
autoload m, "#{self}::#{m}".underscore
|
15
15
|
|
16
|
-
# model
|
17
|
-
module_name = self.to_s.sub("::#{self.to_s.demodulize}", '').constantize
|
18
|
-
module_name.autoload m, "#{self}::Model::#{m}".underscore
|
19
|
-
|
20
16
|
modules[i] = "#{self}::#{m}".constantize
|
21
17
|
end
|
22
18
|
|
23
19
|
include *modules
|
24
20
|
end
|
21
|
+
|
22
|
+
def model(*modules)
|
23
|
+
modules.each_with_index do |m, i|
|
24
|
+
# model
|
25
|
+
module_name = self.to_s.sub("::#{self.to_s.demodulize}", '').constantize
|
26
|
+
module_name.autoload m, "#{self}::Model::#{m}".underscore
|
27
|
+
end
|
28
|
+
end
|
25
29
|
end
|
26
30
|
|
27
31
|
attr_reader :api
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: driver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- hiro-su
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -75,7 +75,6 @@ extra_rdoc_files: []
|
|
75
75
|
files:
|
76
76
|
- ".gitignore"
|
77
77
|
- ".rspec"
|
78
|
-
- APIClient.png
|
79
78
|
- Gemfile
|
80
79
|
- LICENSE.txt
|
81
80
|
- README.md
|
@@ -85,16 +84,6 @@ files:
|
|
85
84
|
- lib/driver/api.rb
|
86
85
|
- lib/driver/client.rb
|
87
86
|
- lib/driver/model.rb
|
88
|
-
- spec/driver_spec.rb
|
89
|
-
- spec/dummy/bin/dummy
|
90
|
-
- spec/dummy/lib/dummy.rb
|
91
|
-
- spec/dummy/lib/dummy/client.rb
|
92
|
-
- spec/dummy/lib/dummy/client/api.rb
|
93
|
-
- spec/dummy/lib/dummy/client/api/database.rb
|
94
|
-
- spec/dummy/lib/dummy/client/api/table.rb
|
95
|
-
- spec/dummy/lib/dummy/client/database.rb
|
96
|
-
- spec/dummy/lib/dummy/client/model/database.rb
|
97
|
-
- spec/spec_helper.rb
|
98
87
|
homepage: https://github.com/hiro-su/driver
|
99
88
|
licenses:
|
100
89
|
- MIT
|
@@ -119,15 +108,4 @@ rubygems_version: 2.4.5
|
|
119
108
|
signing_key:
|
120
109
|
specification_version: 4
|
121
110
|
summary: Simple Framework for API Client.
|
122
|
-
test_files:
|
123
|
-
- spec/driver_spec.rb
|
124
|
-
- spec/dummy/bin/dummy
|
125
|
-
- spec/dummy/lib/dummy.rb
|
126
|
-
- spec/dummy/lib/dummy/client.rb
|
127
|
-
- spec/dummy/lib/dummy/client/api.rb
|
128
|
-
- spec/dummy/lib/dummy/client/api/database.rb
|
129
|
-
- spec/dummy/lib/dummy/client/api/table.rb
|
130
|
-
- spec/dummy/lib/dummy/client/database.rb
|
131
|
-
- spec/dummy/lib/dummy/client/model/database.rb
|
132
|
-
- spec/spec_helper.rb
|
133
|
-
has_rdoc:
|
111
|
+
test_files: []
|
data/APIClient.png
DELETED
Binary file
|
data/spec/driver_spec.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Driver do
|
4
|
-
let(:client) { Dummy::Client.new('apikey', 'secret') }
|
5
|
-
|
6
|
-
describe "Dummy Client" do
|
7
|
-
it "return Dummy::Client instance" do
|
8
|
-
expect(client.class).to eq Dummy::Client
|
9
|
-
expect(client.apikey).to eq "apikey"
|
10
|
-
expect(client.secret).to eq "secret"
|
11
|
-
end
|
12
|
-
|
13
|
-
it "return Dummy::Client::API instance" do
|
14
|
-
expect(client.api.class).to eq Dummy::Client::API
|
15
|
-
expect(client.api.create_database("test")).to eq "create_database: test"
|
16
|
-
expect(client.api.drop_table("test")).to eq "drop_table: test"
|
17
|
-
end
|
18
|
-
|
19
|
-
it "return Dummy::Database instance" do
|
20
|
-
expect(client.db.class).to eq Dummy::Database
|
21
|
-
expect(client.db.create("test")).to eq "create_database: test"
|
22
|
-
expect(client.db.delete("test")).to eq "drop_table: test"
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
data/spec/dummy/bin/dummy
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'pathname'
|
4
|
-
$LOAD_PATH << Pathname.new(__FILE__).dirname.join('..', '..', '..', 'lib').expand_path.to_s
|
5
|
-
$LOAD_PATH << Pathname.new(__FILE__).dirname.join('..', 'lib').expand_path.to_s
|
6
|
-
|
7
|
-
require 'dummy'
|
8
|
-
|
9
|
-
client = Dummy::Client.new('apikey', 'secret')
|
10
|
-
puts client.db.create("testdb")
|
11
|
-
puts client.db.delete("testdb")
|
@@ -1,15 +0,0 @@
|
|
1
|
-
module Dummy
|
2
|
-
class Client
|
3
|
-
class API < Driver::API
|
4
|
-
drive Database, Table
|
5
|
-
|
6
|
-
def initialize(apikey, secret, options = {})
|
7
|
-
@apikey = apikey
|
8
|
-
@secret = secret
|
9
|
-
@options = options
|
10
|
-
end
|
11
|
-
|
12
|
-
attr_accessor :apikey, :secret, :options
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
data/spec/dummy/lib/dummy.rb
DELETED
data/spec/spec_helper.rb
DELETED
@@ -1,84 +0,0 @@
|
|
1
|
-
require "bundler/setup"
|
2
|
-
Bundler.require :default
|
3
|
-
|
4
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
5
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), %w(.. lib)))
|
6
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), %w(dummy lib)))
|
7
|
-
|
8
|
-
require 'driver'
|
9
|
-
require 'dummy'
|
10
|
-
require 'rspec'
|
11
|
-
|
12
|
-
RSpec.configure do |config|
|
13
|
-
# rspec-expectations config goes here. You can use an alternate
|
14
|
-
# assertion/expectation library such as wrong or the stdlib/minitest
|
15
|
-
# assertions if you prefer.
|
16
|
-
config.expect_with :rspec do |expectations|
|
17
|
-
# This option will default to `true` in RSpec 4. It makes the `description`
|
18
|
-
# and `failure_message` of custom matchers include text for helper methods
|
19
|
-
# defined using `chain`, e.g.:
|
20
|
-
# be_bigger_than(2).and_smaller_than(4).description
|
21
|
-
# # => "be bigger than 2 and smaller than 4"
|
22
|
-
# ...rather than:
|
23
|
-
# # => "be bigger than 2"
|
24
|
-
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
25
|
-
end
|
26
|
-
|
27
|
-
# rspec-mocks config goes here. You can use an alternate test double
|
28
|
-
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
29
|
-
config.mock_with :rspec do |mocks|
|
30
|
-
# Prevents you from mocking or stubbing a method that does not exist on
|
31
|
-
# a real object. This is generally recommended, and will default to
|
32
|
-
# `true` in RSpec 4.
|
33
|
-
mocks.verify_partial_doubles = true
|
34
|
-
end
|
35
|
-
|
36
|
-
# The settings below are suggested to provide a good initial experience
|
37
|
-
# with RSpec, but feel free to customize to your heart's content.
|
38
|
-
=begin
|
39
|
-
# These two settings work together to allow you to limit a spec run
|
40
|
-
# to individual examples or groups you care about by tagging them with
|
41
|
-
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
42
|
-
# get run.
|
43
|
-
config.filter_run :focus
|
44
|
-
config.run_all_when_everything_filtered = true
|
45
|
-
|
46
|
-
# Limits the available syntax to the non-monkey patched syntax that is
|
47
|
-
# recommended. For more details, see:
|
48
|
-
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
49
|
-
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
50
|
-
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
|
51
|
-
config.disable_monkey_patching!
|
52
|
-
|
53
|
-
# This setting enables warnings. It's recommended, but in some cases may
|
54
|
-
# be too noisy due to issues in dependencies.
|
55
|
-
config.warnings = true
|
56
|
-
|
57
|
-
# Many RSpec users commonly either run the entire suite or an individual
|
58
|
-
# file, and it's useful to allow more verbose output when running an
|
59
|
-
# individual spec file.
|
60
|
-
if config.files_to_run.one?
|
61
|
-
# Use the documentation formatter for detailed output,
|
62
|
-
# unless a formatter has already been configured
|
63
|
-
# (e.g. via a command-line flag).
|
64
|
-
config.default_formatter = 'doc'
|
65
|
-
end
|
66
|
-
|
67
|
-
# Print the 10 slowest examples and example groups at the
|
68
|
-
# end of the spec run, to help surface which specs are running
|
69
|
-
# particularly slow.
|
70
|
-
config.profile_examples = 10
|
71
|
-
|
72
|
-
# Run specs in random order to surface order dependencies. If you find an
|
73
|
-
# order dependency and want to debug it, you can fix the order by providing
|
74
|
-
# the seed, which is printed after each run.
|
75
|
-
# --seed 1234
|
76
|
-
config.order = :random
|
77
|
-
|
78
|
-
# Seed global randomization in this process using the `--seed` CLI option.
|
79
|
-
# Setting this allows you to use `--seed` to deterministically reproduce
|
80
|
-
# test failures related to randomization by passing the same `--seed` value
|
81
|
-
# as the one that triggered the failure.
|
82
|
-
Kernel.srand config.seed
|
83
|
-
=end
|
84
|
-
end
|