fmrest-core 0.20.0 → 0.22.0

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: 45fc41042ceaacc56c0d27b9d705a635ddad09f34d7e9dbdd33b0965a61a59b3
4
- data.tar.gz: 37d8f75cb978808a08745efa558aa58c4369a43b023336c1b67f3921c6031cba
3
+ metadata.gz: b7ac58128c88341bca022d6470847a1bf0ee489daf71323697e17ba103f0325f
4
+ data.tar.gz: 7061ed4af4f344646aa4dd4935242f00751473885302cb257283183aadbed763
5
5
  SHA512:
6
- metadata.gz: 7cf50096d31b71e98238a2a4cde059ff771c32929298c277aa9972fb2ec6ddb4a5ebaeef227e6bb63dba2ccc8e8240afb500db4b88669b67b66a5e9887cbd8cf
7
- data.tar.gz: 2b706a20520719bb1311a7b72c5be838168cb88701904da2ffcd5fcdb973015f825447d5367104819387e1d391af26f289105ac1ae7ccf03ea74f6801f097d68
6
+ metadata.gz: db124b9095a6a8636e5edea83ba9b2c1517aff515336daa37cb882db1818f02f5fb6ceb2eaac7d980d433bbef2892fa708bbb1087fc9bbde1829cd22f738dd67
7
+ data.tar.gz: 587890573a26cc811da0a7327d4b8b3799f9f7717fb6885b4f2d8414922d48eb53cb54c3cad52050e56bc998e9ade720fe7cd835a9bd36184afbb4271f12729f
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ## Changelog
2
2
 
3
+ ### 0.21.0
4
+
5
+ * Support for Spyke 7 and Faraday 2
6
+ * Drop support for Faraday 1
7
+ * Drop support for Ruby 2.5
8
+
3
9
  ### 0.20.0
4
10
 
5
11
  * Forward proxy options to AWS Client when using `fmrest-cloud` gem
data/README.md CHANGED
@@ -3,6 +3,7 @@
3
3
  [![Gem Version](https://badge.fury.io/rb/fmrest.svg?style=flat)](https://rubygems.org/gems/fmrest)
4
4
  ![CI](https://github.com/beezwax/fmrest-ruby/workflows/CI/badge.svg)
5
5
  [![Yard Docs](http://img.shields.io/badge/yard-docs-blue.svg)](https://rubydoc.info/github/beezwax/fmrest-ruby)
6
+ [![Powered by Beezwax](https://img.shields.io/badge/Powered%20By-Beezwax-gold?logo=data:image/svg+xml;charset=utf-8;base64,PHN2ZyB3aWR0aD0iMTA5IiBoZWlnaHQ9IjEwOSIgdmlld0JveD0iMCAwIDEwOSAxMDkiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+DQogICA8Zz4NCiAgICAgIDxwYXRoIGQ9Ik01MC44IDEwNi42MjVDNTkuMSA5OS4zMjUgNjEuOSA5MS42MjUgNjEuOSA5MS42MjVDNjMuMiA4Ny43MjUgNjQuNyA4NC41MjUgNjQuNyA2OS4zMjVDNjQuNyA0Ni40MjUgNTYuMiAzOC45MjUgNDcgMzIuMDI1QzQwLjggMjcuMzI1IDI0LjkgMjEuMTI1IDE1LjUgMTcuNjI1TDIuMjk5OTggMjUuMTI1QzEuNDk5OTggMjUuNzI1IDAuOTk5OTc2IDI2LjIyNSAwLjU5OTk3NiAyNi44MjVDMjQuNCAzMi4xMjUgNDEuNSA0OC4wMjUgNDEuNSA2Ni44MjVDNDEuNSA3OC4yMjUgMzUuMSA4OC42MjUgMjQuOSA5Ni4xMjVMNDQuNyAxMDcuNTI1QzQ1LjEgMTA3LjcyNSA0NiAxMDguMTI1IDQ3LjMgMTA4LjEyNUM0Ny45IDEwOC4xMjUgNDkgMTA3LjkyNSA1MC4zIDEwNi44MjVMNTAuOCAxMDYuNjI1WiIgZmlsbD0iI0ZGRDkzOSI+PC9wYXRoPg0KICAgICAgPHBhdGggZD0iTTIyLjkgMTMuMzI0OEw0NCAyMC40MjQ4QzY0LjYgMjcuNzI0OCA3My4yIDM3LjgyNDggNzMuMiAzNy44MjQ4Qzg0LjUgNDkuMTI0OCA4My4yIDYxLjYyNDggODMuMiA3Ni44MjQ4QzgzLjIgODAuNjI0OCA4Mi42IDg0LjkyNDggODEuNyA4OS4wMjQ4TDkzIDgyLjYyNDhDOTUuNiA4MS4xMjQ4IDk1LjYgNzcuOTI0OCA5NS42IDc3LjkyNDhWMjkuMzI0OEM5NS42IDI2LjEyNDggOTMgMjQuNjI0OCA5MyAyNC42MjQ4TDcyLjUgMTMuMjI0OEw1MC42IDAuNjI0ODQ1QzQ4LjEgLTAuNjc1MTU1IDQ1LjUgMC40MjQ4NDUgNDUuMyAwLjYyNDg0NUwyMy4xIDEzLjMyNDhIMjIuOVoiIGZpbGw9IiNGRkQ5MzkiPjwvcGF0aD4NCiAgICAgIDxwYXRoIGQ9Ik0wLjEgMzEuNTI0NFY3OC4yMjQ0QzAuMSA4MC44MjQ0IDIuMiA4Mi4zMjQ0IDIuNyA4Mi43MjQ0TDE0LjggODkuNjI0NEwxNy44IDkxLjMyNDRDMjQuNCA4NC43MjQ0IDI4LjQgNzYuMzI0NCAyOC41IDY3LjEyNDRDMjguNSA1MS41MjQ0IDE2LjggMzguMDI0NCAwIDMxLjUyNDRIMC4xWiIgZmlsbD0iI0ZGRDkzOSI+PC9wYXRoPg0KICAgPC9nPg0KPC9zdmc+)](https://beezwax.net/)
6
7
 
7
8
  A Ruby client for
8
9
  [FileMaker's Data API](https://help.claris.com/en/data-api-guide)
@@ -16,29 +17,16 @@ is natively supported by the gem.
16
17
  Need Ruby or FileMaker consulting? Contact us at
17
18
  [Beezwax.net](https://beezwax.net/)
18
19
 
19
- ## Contents
20
-
21
- * [Gems](#gems)
22
- * [Installation](#installation)
23
- * [Simple example](#simple-example)
24
- * [Connection settings](#connection-settings)
25
- * [Session token store](#session-token-store)
26
- * [Date fields and timezones](#date-fields-and-timezones)
27
- * [ActiveRecord-like ORM (fmrest-spyke)](#activerecord-like-orm-fmrest-spyke)
28
- * [Logging](#logging)
29
- * [Gotchas](#gotchas)
30
- * [API implementation completeness table](#api-implementation-completeness-table)
31
- * [Supported Ruby versions](#supported-ruby-versions)
32
-
33
20
  ## Gems
34
21
 
35
- The `fmrest` gem is a wrapper for two other gems:
22
+ The `fmrest` gem is a wrapper for these gems:
36
23
 
37
24
  * `fmrest-spyke`, providing an ActiveRecord-like ORM library built on top
38
25
  of `fmrest-core` and [Spyke](https://github.com/balvig/spyke).
39
26
  * `fmrest-core`, providing the core
40
27
  [Faraday](https://github.com/lostisland/faraday) connection builder, session
41
28
  management, and other core utilities.
29
+ * `fmrest-rails`, providing Rails integration.
42
30
 
43
31
  In addition, the optional `fmrest-cloud` gem adds support for FileMaker Cloud.
44
32
  See the [main document on connecting to FileMaker
@@ -55,6 +43,12 @@ gem 'fmrest'
55
43
  gem 'fmrest-cloud'
56
44
  ```
57
45
 
46
+ If you're using Rails you can now run:
47
+
48
+ ```
49
+ rails generate fmrest:config
50
+ ```
51
+
58
52
  ## Simple example
59
53
 
60
54
  ```ruby
@@ -124,7 +118,8 @@ to, for instance, disable SSL verification:
124
118
  {
125
119
  host: "…",
126
120
 
127
- ssl: { verify: false }
121
+ ssl: { verify: false },
122
+ proxy: "http://user:password@proxy.host:4321"
128
123
  }
129
124
  ```
130
125
 
@@ -135,13 +130,13 @@ You can also pass a `:log` option for basic request logging, see the section on
135
130
 
136
131
  Option | Description | Format | Default
137
132
  --------------------|--------------------------------------------|-----------------------------|--------
138
- `:host` | Hostname with optional port, e.g. `"example.com:9000"` | String | None
133
+ `:host` | Hostname with optional port, e.g. `example.com:9000` | String | None
139
134
  `:database` | The name of the database to connect to | String | None
140
135
  `:username` | A Data API-ready account | String | None
141
136
  `:password` | Your password | String | None
142
137
  `:account_name` | Alias of `:username` | String | None
143
- `:ssl` | SSL options to be forwarded to Faraday | Faraday SSL options | None
144
- `:proxy` | Proxy URI e.g. `http://username:password@proxy.host:5000` | String / URI | None
138
+ `:ssl` | SSL options to be forwarded to Faraday | [Faraday SSL options](https://www.rubydoc.info/gems/faraday/Faraday/SSLOptions) hash | None
139
+ `:proxy` | Proxy URI, e.g. `http://user:password@proxy.host:4321` | String | None
145
140
  `:log` | Log JSON responses to STDOUT | Boolean | `false`
146
141
  `:log_level` | Which log level to log into | Values accepted by `Logger#level=` | `:debug`
147
142
  `:coerce_dates` | See section on [date fields](#date-fields-and-timezones) | Boolean \| `:hybrid` \| `:full` | `false`
@@ -561,13 +556,8 @@ FM Data API reference: https://help.claris.com/en/data-api-guide/
561
556
 
562
557
  ## Supported Ruby versions
563
558
 
564
- fmrest-ruby aims to support and is [tested against](https://github.com/beezwax/fmrest-ruby/actions?query=workflow%3ACI)
565
- the following Ruby implementations:
566
-
567
- * Ruby 2.5
568
- * Ruby 2.6
569
- * Ruby 2.7
570
- * Ruby 3.0
559
+ fmrest-ruby is [tested against](https://github.com/beezwax/fmrest-ruby/actions?query=workflow%3ACI)
560
+ Ruby 2.6 through 3.1.
571
561
 
572
562
  ## Gem development
573
563
 
@@ -72,7 +72,7 @@ module FmRest
72
72
  elsif is_cloud_host
73
73
  conn.request :authorization, CLARIS_ID_HTTP_AUTH_TYPE, -> { Cloud::ClarisIdTokenManager.new(settings).fetch_token }
74
74
  else
75
- conn.request :basic_auth, settings.username!, settings.password!
75
+ conn.request :authorization, :basic, settings.username!, settings.password!
76
76
  end
77
77
 
78
78
  if settings.log
@@ -80,11 +80,11 @@ module FmRest
80
80
 
81
81
  connection.post do |request|
82
82
  request.url container_path
83
- request.headers['Content-Type'] = ::Faraday::Request::Multipart.mime_type
83
+ request.headers['Content-Type'] = ::Faraday::Multipart::Middleware.mime_type
84
84
 
85
85
  filename = options[:filename] || filename_or_io.try(:original_filename)
86
86
 
87
- request.body = { upload: Faraday::UploadIO.new(filename_or_io, content_type, filename) }
87
+ request.body = { upload: Faraday::Multipart::FilePart.new(filename_or_io, content_type, filename) }
88
88
  end
89
89
  end
90
90
 
@@ -5,7 +5,7 @@ module FmRest
5
5
  # FM Data API response middleware for raising exceptions on API response
6
6
  # errors
7
7
  #
8
- class RaiseErrors < Faraday::Response::Middleware
8
+ class RaiseErrors < Faraday::Middleware
9
9
  # Error codes reference:
10
10
  # https://help.claris.com/en/pro-help/content/error-codes.html
11
11
  ERROR_RANGES = {
@@ -4,7 +4,7 @@ require "fmrest/string_date"
4
4
 
5
5
  module FmRest
6
6
  module V1
7
- class TypeCoercer < Faraday::Response::Middleware
7
+ class TypeCoercer < Faraday::Middleware
8
8
  # We use this date to represent a FileMaker time for consistency with
9
9
  # ginjo-rfm
10
10
  JULIAN_ZERO_DAY = "-4712/1/1"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FmRest
4
- VERSION = "0.20.0"
4
+ VERSION = "0.22.0"
5
5
  end
data/lib/fmrest.rb CHANGED
@@ -1,17 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "faraday"
4
- require "faraday_middleware"
4
+ require "faraday/multipart"
5
5
 
6
6
  require "fmrest/version"
7
7
  require "fmrest/connection_settings"
8
8
  require "fmrest/errors"
9
9
 
10
10
  module FmRest
11
- autoload :V1, "fmrest/v1"
12
- autoload :TokenStore, "fmrest/token_store"
13
- autoload :Spyke, "fmrest/spyke"
14
- autoload :Layout, "fmrest/spyke"
11
+ autoload :V1, "fmrest/v1"
12
+ autoload :TokenStore, "fmrest/token_store"
13
+ autoload :Spyke, "fmrest/spyke"
14
+ autoload :Layout, "fmrest/spyke"
15
+ autoload :StringDateAwareness, "fmrest/string_date"
15
16
 
16
17
  class << self
17
18
  attr_accessor :token_store
@@ -68,3 +69,9 @@ module FmRest
68
69
  end
69
70
  end
70
71
  end
72
+
73
+ begin
74
+ require "fmrest/railtie" if defined?(Rails::Railtie)
75
+ # In case fmrest-rails is not installed
76
+ rescue LoadError
77
+ 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,23 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fmrest-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.0
4
+ version: 0.22.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pedro Carbajal
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-10-26 00:00:00.000000000 Z
11
+ date: 2022-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
18
- - !ruby/object:Gem::Version
19
- version: 1.8.0
20
- - - "<"
21
18
  - !ruby/object:Gem::Version
22
19
  version: '2.0'
23
20
  type: :runtime
@@ -25,31 +22,22 @@ dependencies:
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
24
  - - ">="
28
- - !ruby/object:Gem::Version
29
- version: 1.8.0
30
- - - "<"
31
25
  - !ruby/object:Gem::Version
32
26
  version: '2.0'
33
27
  - !ruby/object:Gem::Dependency
34
- name: faraday_middleware
28
+ name: faraday-multipart
35
29
  requirement: !ruby/object:Gem::Requirement
36
30
  requirements:
37
31
  - - ">="
38
32
  - !ruby/object:Gem::Version
39
- version: 0.9.1
40
- - - "<"
41
- - !ruby/object:Gem::Version
42
- version: '2.0'
33
+ version: '0'
43
34
  type: :runtime
44
35
  prerelease: false
45
36
  version_requirements: !ruby/object:Gem::Requirement
46
37
  requirements:
47
38
  - - ">="
48
39
  - !ruby/object:Gem::Version
49
- version: 0.9.1
50
- - - "<"
51
- - !ruby/object:Gem::Version
52
- version: '2.0'
40
+ version: '0'
53
41
  description: fmrest-core is a FileMaker Data API client built with Faraday. It handles
54
42
  authentication as well as providing many utilities for working with the Data API.
55
43
  An ORM library built on top of fmrest-core is also available.
@@ -89,6 +77,11 @@ files:
89
77
  - lib/fmrest/v1/type_coercer.rb
90
78
  - lib/fmrest/v1/utils.rb
91
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
92
85
  homepage: https://github.com/beezwax/fmrest-ruby
93
86
  licenses:
94
87
  - MIT
@@ -108,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
101
  - !ruby/object:Gem::Version
109
102
  version: '0'
110
103
  requirements: []
111
- rubygems_version: 3.2.3
104
+ rubygems_version: 3.3.3
112
105
  signing_key:
113
106
  specification_version: 4
114
107
  summary: FileMaker Data API client using Faraday, core library