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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 89b456fbf978ac888186346f34d5ccc08237555584979309c24e4a9462783b97
4
- data.tar.gz: e0bcdc296f89edb7319f177a9f9ae09778812e96149b1a7406b0eb6ed8f28307
3
+ metadata.gz: dc6d9337b8306425cbf0f2cece6a19bbc6c78015fd08dc0cb8584a4cc354fca7
4
+ data.tar.gz: 3c413e3c6cc3687d24195d7374120856205759005320b226d3191fc1b8ac47e2
5
5
  SHA512:
6
- metadata.gz: 5b309a738cbcc926ebf41cfe3be8e338ab1fe27d325ee7fd4c571265fe5de2a3841fb46d3949d41c6cbf7103fb9627977975d797c2636680675b5e4206430c1c
7
- data.tar.gz: 7737a8d9c38fb5288f0445540b910b57425f4008dfa2071e6c95636ba8c21880500f2ba84c056b2857d05b320bddaf9501c66954c4752d0d3ccf3816fe72cc66
6
+ metadata.gz: 3667cbb43aff4af68dd67143995a234593e705839ecd7ac1e9a921c2cd971f67e1f4545fdbfd3a936bb6ef032930b5794bb445e436ad078db3e4dec96b97b983
7
+ data.tar.gz: e135f0d018c883049600e34afd9e2f4d88f4852ab15b78a4afeb590604a94fdd6b435a9a6e55ec3fda84f2221afe210d7c29e23958d780254fea5df39e7a55f6
@@ -1,5 +1,8 @@
1
1
  inherit_from: .rubocop_todo.yml
2
2
 
3
+ Metrics/LineLength:
4
+ Enabled: false
5
+
3
6
  Metrics/BlockLength:
4
7
  Exclude:
5
8
  - spec/**/*_spec.rb
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2019-08-27 17:28:54 -0400 using RuboCop version 0.74.0.
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
- # Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
12
- # URISchemes: http, https
13
- Metrics/LineLength:
14
- Max: 81
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'
@@ -0,0 +1 @@
1
+ ruby 2.6.5
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- graphql-types-money (0.2.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.5)
14
+ concurrent-ruby (1.1.6)
15
15
  diff-lcs (1.3)
16
- graphql (1.9.10)
16
+ graphql (1.10.3)
17
17
  htmlentities (4.3.4)
18
- i18n (1.6.0)
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.4)
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.0.2
88
+ 2.1.1
@@ -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.2.0'
7
+ spec.version = '1.0.0'
10
8
  spec.authors = ['Ian Ker-Seymer']
11
9
  spec.email = ['i.kerseymer@gmail.com']
12
10
 
@@ -5,8 +5,8 @@ require 'graphql'
5
5
 
6
6
  module GraphQL
7
7
  module Types
8
- ISO4217 = GraphQL::EnumType.define do
9
- name 'ISO4217'
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 = GraphQL::ObjectType.define do
18
- name 'Currency'
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 :isoCode, ISO4217, 'The currency format as defined by IS0 4217.' do
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, types.String, 'The symbol for the currency (i.e. "€").'
23
+ field :symbol, String, 'The symbol for the currency (i.e. "€").', null: false
26
24
 
27
- field :smallestDenomination do
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 :subunitToUnit do
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 = GraphQL::ObjectType.define do
41
- name 'Money'
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, types.Int, 'Fractional unit value of a given currency.'
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 :amount, types.Float, 'Numerical amount of the money.'
38
+ field :currency, Currency, null: false
47
39
 
48
- field :currency, Currency
40
+ field :display_string, String, 'Displayable string (i.e. "$1.00").', null: false
49
41
 
50
- field :displayString, types.String, 'Displayable string (i.e. "$1.00").' do
51
- resolve ->(obj, *) { obj.format }
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 = GraphQL::InputObjectType.define do
9
- name 'MoneyInput'
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, !types.Int, 'Fractional unit value of a given '\
14
- 'currency'
13
+ argument :fractional, Integer, 'Fractional unit value of a given currency', required: true
15
14
 
16
- argument :isoCode,
17
- ISO4217.to_non_null_type,
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.2.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: 2019-08-29 00:00:00.000000000 Z
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