fmrest-core 0.21.0 → 0.23.1

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
  SHA256:
3
- metadata.gz: 1dcd50851dca459061ccd7a2f55a2b3dcadea27ed5aa91aa854fb23660747667
4
- data.tar.gz: ee483bb0ded64cda1342d38a9afa97789e1bcc6b813602543787c049eea038b8
3
+ metadata.gz: e4204d06743939015713907f35c283ff99decd257a0aaee50593ed3a660b87d9
4
+ data.tar.gz: ca4a4c30b8a06d0f3eb20601d9003328d2c63e651f9acf35c03838ba690fddfc
5
5
  SHA512:
6
- metadata.gz: 5570a533c122bbfae3d3cbdbcee96bdf4ed1d3ebfe43691ec92acb0ed078a2b5badf0cf546afd2d6a9d877425203fefab737bf24594b92cf64639c66ebb51ba4
7
- data.tar.gz: adbd2c191f65cc2a67f2db3b571f7c287c12eddbfd6c3c31e32a5d730b7d8ada2f61197c9e0df731aa748b1a2caa443ca3d17d16f483437107d16fc4440c6f79
6
+ metadata.gz: 58817b269adc26fa4c74f180ac4b1b8de5578bb041979bf694fa2b977a96a2830368c21617b1e82722b266f8c6829772c94332afbc527680d3e6146ebec0786c
7
+ data.tar.gz: 3306e169f3aad1b6c32291cc9541b354f8316baa7d08abbd3ac31fe453d8051abd0352a065a7d1b4fd9857b08f9d7bd106725ebfab5807492bad305ca437328c
data/.yardopts CHANGED
@@ -1,5 +1,6 @@
1
1
  --markup markdown
2
2
  --plugin activesupport-concern
3
- lib/**/*.rb
3
+ --exclude lib/generators/*
4
4
  -
5
+ lib/**/*.rb
5
6
  docs/*
data/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  ## Changelog
2
2
 
3
+ ### 0.23.1
4
+
5
+ * Fix crash when booting in Rails and `config/fmrest.yml` didn't exist
6
+
7
+ ### 0.23.0
8
+
9
+ * Add `find_one!` (aliased as `first!`) exception-raising method
10
+ * Add mapping of API exceptions to HTTP responses in Rails
11
+
12
+ ### 0.22.0
13
+
14
+ * Add `fmrest-rails` gem with Rails integration (initializer, generators)
15
+
3
16
  ### 0.21.0
4
17
 
5
18
  * Support for Spyke 7 and Faraday 2
data/README.md CHANGED
@@ -19,13 +19,14 @@ Need Ruby or FileMaker consulting? Contact us at
19
19
 
20
20
  ## Gems
21
21
 
22
- The `fmrest` gem is a wrapper for two other gems:
22
+ The `fmrest` gem is a wrapper for these gems:
23
23
 
24
24
  * `fmrest-spyke`, providing an ActiveRecord-like ORM library built on top
25
25
  of `fmrest-core` and [Spyke](https://github.com/balvig/spyke).
26
26
  * `fmrest-core`, providing the core
27
27
  [Faraday](https://github.com/lostisland/faraday) connection builder, session
28
28
  management, and other core utilities.
29
+ * `fmrest-rails`, providing Rails integration.
29
30
 
30
31
  In addition, the optional `fmrest-cloud` gem adds support for FileMaker Cloud.
31
32
  See the [main document on connecting to FileMaker
@@ -42,6 +43,12 @@ gem 'fmrest'
42
43
  gem 'fmrest-cloud'
43
44
  ```
44
45
 
46
+ If you're using Rails you can now run:
47
+
48
+ ```
49
+ rails generate fmrest:config
50
+ ```
51
+
45
52
  ## Simple example
46
53
 
47
54
  ```ruby
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FmRest
4
- VERSION = "0.21.0"
4
+ VERSION = "0.23.1"
5
5
  end
data/lib/fmrest.rb CHANGED
@@ -48,10 +48,9 @@ module FmRest
48
48
  end
49
49
  end
50
50
 
51
- # Shortcut for FmRest::V1.escape_find_operators
51
+ # Shortcut for `FmRest::V1.escape_find_operators`
52
52
  #
53
- # @param (see FmRest::V1.escape_find_operators
54
- # @return (see FmRest::V1.escape_find_operators
53
+ # @see FmRest::V1.escape_find_operators
55
54
  def e(s)
56
55
  V1.escape_find_operators(s)
57
56
  end
@@ -69,3 +68,9 @@ module FmRest
69
68
  end
70
69
  end
71
70
  end
71
+
72
+ begin
73
+ require "fmrest/railtie" if defined?(Rails::Railtie)
74
+ # In case fmrest-rails is not installed
75
+ rescue LoadError
76
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This is capitalized differently (Fmrest vs FmRest) on purpose, so the
4
+ # generator can be found as "fmrest:config"
5
+ module Fmrest
6
+ module Generators
7
+ class ConfigGenerator < Rails::Generators::Base
8
+ source_root File.expand_path('templates', __dir__)
9
+
10
+ def copy_config_file
11
+ copy_file "fmrest.yml", "config/fmrest.yml"
12
+ end
13
+
14
+ def copy_initializer_file
15
+ copy_file "fmrest_initializer.rb", "config/initializers/fmrest.rb"
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,18 @@
1
+ development:
2
+ host:
3
+ database:
4
+ username:
5
+ password:
6
+
7
+ # Additional options
8
+ #
9
+ # log: false
10
+ #
11
+ # ssl:
12
+ # verify: true
13
+
14
+ test:
15
+ host:
16
+ database:
17
+ username:
18
+ password:
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Use ActiveRecord token store
4
+ FmRest.token_store = FmRest::TokenStore::ActiveRecord
5
+
6
+ # Use ActiveRecord token store with custom table name
7
+ # FmRest.token_store = FmRest::TokenStore::ActiveRecord.new(table_name: "my_token_store")
8
+
9
+ # Use Redis token store (requires redis gem)
10
+ # FmRest.token_store = FmRest::TokenStore::Redis
11
+
12
+ # Use Redis token store with custom prefix
13
+ # FmRest.token_store = FmRest::TokenStore::Redis.new(prefix: "my-fmrest-token:")
14
+
15
+ # Use Moneta token store (requires moneta gem)
16
+ # FmRest.token_store = FmRest::TokenStore::Moneta.new(backend: )
17
+
18
+ # Use Memory token store (not suitable for production)
19
+ # FmRest.token_store = FmRest::TokenStore::Memory
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This is capitalized differently (Fmrest vs FmRest) on purpose, so the
4
+ # generator can be found as "fmrest:config"
5
+ module Fmrest
6
+ module Generators
7
+ class ModelGenerator < Rails::Generators::NamedBase
8
+ source_root File.expand_path('templates', __dir__)
9
+
10
+ def create_model_file
11
+ template "model.rb", "app/models/#{file_name}.rb"
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ class <%= class_name %> < FmRest::Layout
4
+ # Uncomment if your layout name isn't "<%= class_name %>", or delete:
5
+ # layout "<%= plural_name %>"
6
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fmrest-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.21.0
4
+ version: 0.23.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pedro Carbajal
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-05-12 00:00:00.000000000 Z
11
+ date: 2022-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -77,6 +77,11 @@ files:
77
77
  - lib/fmrest/v1/type_coercer.rb
78
78
  - lib/fmrest/v1/utils.rb
79
79
  - lib/fmrest/version.rb
80
+ - lib/generators/fmrest/config/config_generator.rb
81
+ - lib/generators/fmrest/config/templates/fmrest.yml
82
+ - lib/generators/fmrest/config/templates/fmrest_initializer.rb
83
+ - lib/generators/fmrest/model/model_generator.rb
84
+ - lib/generators/fmrest/model/templates/model.rb
80
85
  homepage: https://github.com/beezwax/fmrest-ruby
81
86
  licenses:
82
87
  - MIT