fern-api 0.0.4 → 0.0.6

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: 6f1feb484ee97318c0faeb503fdc7f08432d5771
4
- data.tar.gz: 657f6d0b56cb4ada9b4a8b07159cba729eed5289
3
+ metadata.gz: 41fbd75c6e06e6f6ad81071060b134ee8d16376d
4
+ data.tar.gz: d8e4743dbed7572ec410e05df30868f398d5d843
5
5
  SHA512:
6
- metadata.gz: 1ac04b93540a283ef6c7fa296909f7370538268e6b547ae9a1193905df3c6e560704a135b3d736c10b6e6ca184bb3fe40261db8da021596cbf90c4db4c3bd355
7
- data.tar.gz: d68fb0215d07224f449e45b705b136211dd90b92509ccc4f9ae1fc659f31e4981f33a4bbc211c6ee8cb2277d76736db1ac9e191f04526fb254a6ef8d259c0419
6
+ metadata.gz: b3e59c0b2e98731a603799ad47f694caabedc7bf7be43d25475f3f0883c128eb7c2484321f7e1dca23dc9fc85c52d5574aa64787e53ff34421226903e825cee4
7
+ data.tar.gz: c5b566d13f292a7de52d20250fbb19c23ce467c75c79f5d7b53b5d6915d1008a94383a4fb5c72e312ca0a14be36a2b2495018bb3a36607af6141ec27a24798b8
@@ -1,5 +1,5 @@
1
1
  module Fern
2
2
  module Api
3
- VERSION = '0.0.4'.freeze
3
+ VERSION = '0.0.6'.freeze
4
4
  end
5
5
  end
data/lib/fern/api.rb CHANGED
@@ -2,28 +2,24 @@ require 'fern/api/endpoint'
2
2
 
3
3
  module Fern
4
4
  module Api
5
- def self.included(receiver)
6
- receiver.extend(ClassMethods)
7
- end
5
+ extend ActiveSupport::Concern
6
+
7
+ VERBS = %i[delete connect get head options patch post put trace].freeze
8
8
 
9
- module ClassMethods
10
- VERBS = %i[delete get patch post put].freeze
9
+ included do
10
+ class_eval { class_attribute :fern }
11
+ self.fern = {}
12
+ end
11
13
 
14
+ class_methods do
12
15
  def endpoint(name, &block)
16
+ fern[name] = {}
13
17
  Endpoint.new(self, name: name, &block)
14
18
  end
15
19
 
16
- def method_missing(method_name, *args, &block)
17
- if VERBS.include?(method_name)
18
- endpoint(args[0], &block)
19
- else
20
- super
21
- end
22
- end
23
-
24
- def respond_to_missing?(method_name, include_private = false)
25
- VERBS.include?(method_name) || super
26
- end
20
+ VERBS.each { |verb| alias_method verb, :endpoint }
27
21
  end
28
22
  end
29
23
  end
24
+
25
+ ActiveSupport.on_load(:action_controller) { include Fern::Api }
File without changes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fern-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kyle Kestell
@@ -38,16 +38,44 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '5.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: activesupport
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '5.0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '5.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: actionpack
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '5.0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '5.0'
41
69
  description: API DSL for Fern.
42
70
  email: kyle@kestell.org
43
71
  executables: []
44
72
  extensions: []
45
73
  extra_rdoc_files: []
46
74
  files:
75
+ - lib/fern-api.rb
47
76
  - lib/fern/api.rb
48
77
  - lib/fern/api/endpoint.rb
49
78
  - lib/fern/api/version.rb
50
- - lib/fern_api.rb
51
79
  homepage: https://github.com/kkestell/fern-api
52
80
  licenses:
53
81
  - MIT