graphql-types-money 0.2.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/.rubocop_todo.yml +12 -5
- data/.tool-versions +1 -0
- data/Gemfile.lock +6 -6
- data/graphql-types-money.gemspec +1 -3
- data/lib/graphql/types/money.rb +17 -25
- data/lib/graphql/types/money_input.rb +7 -7
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc6d9337b8306425cbf0f2cece6a19bbc6c78015fd08dc0cb8584a4cc354fca7
|
4
|
+
data.tar.gz: 3c413e3c6cc3687d24195d7374120856205759005320b226d3191fc1b8ac47e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3667cbb43aff4af68dd67143995a234593e705839ecd7ac1e9a921c2cd971f67e1f4545fdbfd3a936bb6ef032930b5794bb445e436ad078db3e4dec96b97b983
|
7
|
+
data.tar.gz: e135f0d018c883049600e34afd9e2f4d88f4852ab15b78a4afeb590604a94fdd6b435a9a6e55ec3fda84f2221afe210d7c29e23958d780254fea5df39e7a55f6
|
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
3
|
+
# on 2020-02-20 14:14:27 -0500 using RuboCop version 0.74.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
@@ -8,7 +8,14 @@
|
|
8
8
|
|
9
9
|
# Offense count: 1
|
10
10
|
# Cop supports --auto-correct.
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
Lint/UnneededCopEnableDirective:
|
12
|
+
Exclude:
|
13
|
+
- 'graphql-types-money.gemspec'
|
14
|
+
|
15
|
+
# Offense count: 4
|
16
|
+
Style/Documentation:
|
17
|
+
Exclude:
|
18
|
+
- 'spec/**/*'
|
19
|
+
- 'test/**/*'
|
20
|
+
- 'lib/graphql/types/money.rb'
|
21
|
+
- 'lib/graphql/types/money_input.rb'
|
data/.tool-versions
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby 2.6.5
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
graphql-types-money (0.
|
4
|
+
graphql-types-money (1.0.0)
|
5
5
|
graphql
|
6
6
|
money
|
7
7
|
|
@@ -11,16 +11,16 @@ GEM
|
|
11
11
|
ast (2.4.0)
|
12
12
|
backport (1.1.2)
|
13
13
|
coderay (1.1.2)
|
14
|
-
concurrent-ruby (1.1.
|
14
|
+
concurrent-ruby (1.1.6)
|
15
15
|
diff-lcs (1.3)
|
16
|
-
graphql (1.
|
16
|
+
graphql (1.10.3)
|
17
17
|
htmlentities (4.3.4)
|
18
|
-
i18n (1.
|
18
|
+
i18n (1.8.2)
|
19
19
|
concurrent-ruby (~> 1.0)
|
20
20
|
jaro_winkler (1.5.3)
|
21
21
|
method_source (0.9.2)
|
22
22
|
mini_portile2 (2.4.0)
|
23
|
-
money (6.13.
|
23
|
+
money (6.13.7)
|
24
24
|
i18n (>= 0.6.4, <= 2)
|
25
25
|
nokogiri (1.10.4)
|
26
26
|
mini_portile2 (~> 2.4.0)
|
@@ -85,4 +85,4 @@ DEPENDENCIES
|
|
85
85
|
solargraph
|
86
86
|
|
87
87
|
BUNDLED WITH
|
88
|
-
2.
|
88
|
+
2.1.1
|
data/graphql-types-money.gemspec
CHANGED
@@ -2,11 +2,9 @@
|
|
2
2
|
|
3
3
|
lib = File.expand_path('lib', __dir__)
|
4
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
-
|
6
|
-
# rubocop:disable Metrics/LineLength
|
7
5
|
Gem::Specification.new do |spec|
|
8
6
|
spec.name = 'graphql-types-money'
|
9
|
-
spec.version = '0.
|
7
|
+
spec.version = '1.0.0'
|
10
8
|
spec.authors = ['Ian Ker-Seymer']
|
11
9
|
spec.email = ['i.kerseymer@gmail.com']
|
12
10
|
|
data/lib/graphql/types/money.rb
CHANGED
@@ -5,8 +5,8 @@ require 'graphql'
|
|
5
5
|
|
6
6
|
module GraphQL
|
7
7
|
module Types
|
8
|
-
ISO4217
|
9
|
-
|
8
|
+
class ISO4217 < GraphQL::Schema::Enum
|
9
|
+
graphql_name 'ISO4217'
|
10
10
|
description 'A valid ISO 4217 currency code string.'
|
11
11
|
|
12
12
|
::Money::Currency.all.uniq(&:name).sort_by(&:iso_code).each do |curr|
|
@@ -14,41 +14,33 @@ module GraphQL
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
Currency
|
18
|
-
|
17
|
+
class Currency < GraphQL::Schema::Object
|
18
|
+
graphql_name 'Currency'
|
19
19
|
description 'A currency as defined by the ISO 4217 standard.'
|
20
20
|
|
21
|
-
field :
|
22
|
-
resolve ->(obj, *) { obj.iso_code }
|
23
|
-
end
|
21
|
+
field :iso_code, ISO4217, 'The currency format as defined by IS0 4217.', null: false
|
24
22
|
|
25
|
-
field :symbol,
|
23
|
+
field :symbol, String, 'The symbol for the currency (i.e. "€").', null: false
|
26
24
|
|
27
|
-
field :
|
28
|
-
type types.Int
|
29
|
-
description 'The smallest denomination of the currency.'
|
30
|
-
resolve ->(obj, *) { obj.smallest_denomination }
|
31
|
-
end
|
25
|
+
field :smallest_denomination, Integer, 'The smallest denomination of the currency.', null: false
|
32
26
|
|
33
|
-
field :
|
34
|
-
type types.Int
|
35
|
-
description 'Factor used to convert a subunit to a unit.'
|
36
|
-
resolve ->(obj, *) { obj.subunit_to_unit }
|
37
|
-
end
|
27
|
+
field :subunit_to_unit, Integer, 'Factor used to convert a subunit to a unit.', null: false
|
38
28
|
end
|
39
29
|
|
40
|
-
Money
|
41
|
-
|
30
|
+
class Money < GraphQL::Schema::Object
|
31
|
+
graphql_name 'Money'
|
42
32
|
description 'An object representing money, with an amount and currency.'
|
43
33
|
|
44
|
-
field :fractional,
|
34
|
+
field :fractional, Integer, 'Fractional unit value of a given currency.', null: false
|
35
|
+
|
36
|
+
field :amount, Float, 'Numerical amount of the money.', null: false
|
45
37
|
|
46
|
-
field :
|
38
|
+
field :currency, Currency, null: false
|
47
39
|
|
48
|
-
field :
|
40
|
+
field :display_string, String, 'Displayable string (i.e. "$1.00").', null: false
|
49
41
|
|
50
|
-
|
51
|
-
|
42
|
+
def display_string
|
43
|
+
object.format
|
52
44
|
end
|
53
45
|
end
|
54
46
|
end
|
@@ -5,17 +5,17 @@ require_relative './money'
|
|
5
5
|
|
6
6
|
module GraphQL
|
7
7
|
module Types
|
8
|
-
MoneyInput
|
9
|
-
|
8
|
+
class MoneyInput < GraphQL::Schema::InputObject
|
9
|
+
graphql_name 'MoneyInput'
|
10
10
|
description 'An input object representing money, with an amount and '\
|
11
11
|
'currency'
|
12
12
|
|
13
|
-
argument :fractional,
|
14
|
-
'currency'
|
13
|
+
argument :fractional, Integer, 'Fractional unit value of a given currency', required: true
|
15
14
|
|
16
|
-
argument :
|
17
|
-
ISO4217
|
18
|
-
'The currency format as defined by IS0 4217'
|
15
|
+
argument :iso_code,
|
16
|
+
ISO4217,
|
17
|
+
'The currency format as defined by IS0 4217',
|
18
|
+
required: true
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphql-types-money
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ian Ker-Seymer
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -92,6 +92,7 @@ files:
|
|
92
92
|
- ".rubocop.yml"
|
93
93
|
- ".rubocop_todo.yml"
|
94
94
|
- ".ruby-version"
|
95
|
+
- ".tool-versions"
|
95
96
|
- ".travis.yml"
|
96
97
|
- CODE_OF_CONDUCT.md
|
97
98
|
- Gemfile
|