restpack_service 0.0.75 → 0.0.76

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f6ed8e6b4f31b10b3b917aa726eb90723bb4f5d2
4
- data.tar.gz: 95db13fb733c65f27c8696a00daf4bfd20d03004
3
+ metadata.gz: 2ff9a4eae5f0590fb89b11f07e85f15037562e17
4
+ data.tar.gz: 8d10e8416c9ff99efadaaa3fd27f76fe9467ecab
5
5
  SHA512:
6
- metadata.gz: 2a7b22d45228e91c5f696a6843b5ae46273fa44e9536f833d8e852b835606c19613d1877c8b5c69c66526f9f490ffc130ed45dc7d72f7af49bc44df527652394
7
- data.tar.gz: 7e9923399cd4cddc38dc1b9a566f4bbf89b35e402e1c6762047981ef775a1b501d572d69015e7f9a308816a6cfc1f59c918e4f1cf23e09f63cefb18a3c1edcd0
6
+ metadata.gz: 90c23efcc038018461512c2cf46c2ef25b1fdd2141694859b9723eaa995f44f14f934edbbd2b395bf8f748ea815ba10027f5b7e9fa01f224fc31c63afcdf61cd
7
+ data.tar.gz: 43b4271e9ee8395a3d24584e0679a5e35a012611dbf0b791dcc2a9ffddb9319efaef7926d6c5205cee87f0e2ce596161d476e9afa7a4065e0902d2529a3f6d8e
@@ -68,7 +68,6 @@ module RestPack::Service
68
68
  namespaces = command.to_s.split('::') # eg. GroupService::Commands::Group::Create
69
69
 
70
70
  add_module_aliases(command, namespaces)
71
- add_command_methods(command, namespaces)
72
71
  end
73
72
 
74
73
  private
@@ -85,23 +84,6 @@ module RestPack::Service
85
84
  command.const_set(:Models, "#{namespaces[0]}::Models".safe_constantize)
86
85
  end
87
86
 
88
- def self.add_command_methods(command, namespaces)
89
- method_name = command.name.demodulize.downcase
90
- container = method_container_module(command, namespaces)
91
-
92
- container.send(
93
- :define_singleton_method,
94
- method_name.to_sym,
95
- Proc.new { |*args| command.run(*args) }
96
- )
97
-
98
- container.send(
99
- :define_singleton_method,
100
- "#{method_name}!".to_sym,
101
- Proc.new { |*args| command.run!(*args) }
102
- )
103
- end
104
-
105
87
  def self.method_container_module(command, namespaces)
106
88
  if namespaces[1] == 'Commands'
107
89
  "#{namespaces[0]}::#{namespaces[2]}".safe_constantize #GroupService::Group
@@ -1,5 +1,5 @@
1
1
  module RestPack
2
2
  module Service
3
- VERSION = "0.0.75"
3
+ VERSION = "0.0.76"
4
4
  end
5
5
  end
data/spec/command_spec.rb CHANGED
@@ -2,11 +2,6 @@ require 'spec_helper'
2
2
 
3
3
  describe RestPack::Service::Command do
4
4
  context 'with a commands in a namespace like TextService::Commands::Text::Reverse' do
5
- it 'defines sugar methods' do
6
- expect(TextService::Text).to respond_to(:reverse, :reverse!)
7
- expect(TextService::Text.reverse!(text: 'gavin')).to eq('nivag')
8
- end
9
-
10
5
  it 'defines aliases' do
11
6
  Command = TextService::Commands::Text::Reverse
12
7
  command = Command.new
@@ -21,11 +16,4 @@ describe RestPack::Service::Command do
21
16
  expect(Command::Models).to eq(TextService::Models)
22
17
  end
23
18
  end
24
-
25
- context 'with a commands in a namespace like Commands::Template::Create' do
26
- it 'defines sugar methods' do
27
- expect(Commands::Math).to respond_to(:add, :add!)
28
- expect(Commands::Math.add!(a: 1, b: 2)).to eq(3)
29
- end
30
- end
31
19
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: restpack_service
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.75
4
+ version: 0.0.76
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gavin Joyce