graphlient 0.0.4 → 0.0.5

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: e63b47be656ea6f5f875fd9b4787190e01229e52
4
- data.tar.gz: 563ac147a12a4329fb94c657546ef24509fa35db
3
+ metadata.gz: 74aeacc568a790dea8eb57f285af9d0d4399e32c
4
+ data.tar.gz: 92634c7c7715b0e79d5b947180de4a8ace1f6811
5
5
  SHA512:
6
- metadata.gz: eba95816c8c386c519d774ee5fbb668ec2d78d7f0bb0177da8ba5941cb033b0f5d14da0845d291d2033ce4bcf45d34db4e3a5918a67afa8585f1f1b232c17ed4
7
- data.tar.gz: 2caa1b128e9f8095310ddfca72ef13fe84225b2083f3ae2eead234c9604e97eb25abf51ba5c77ebf50070ff3ccfb4d2b170ff49a95b4060b227b5967323a8b94
6
+ metadata.gz: 9d98e5fe0835525a64865f9fffb75608dd4ee435bd8f83dfc1d9a56e47a789884bf868b56f54c98fe581a0017538b64c487cb4b93fd3cdb684f884b5ebc8af78
7
+ data.tar.gz: 8d1cf6ad272318317058e7b704c4f38a896293a3729ebb7b32e3874d4d5b76d64bfba15a504b03a1d6c380b4d07a7dd721267edc08e15a9bdc146242e0fe52c0
data/.gitignore CHANGED
@@ -42,9 +42,9 @@ build-iPhoneSimulator/
42
42
 
43
43
  # for a library or gem, you might want to ignore these files since the code is
44
44
  # intended to run in multiple environments; otherwise, check them in:
45
- # Gemfile.lock
46
- # .ruby-version
47
- # .ruby-gemset
45
+ Gemfile.lock
46
+ .ruby-version
47
+ .ruby-gemset
48
48
 
49
49
  # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
50
50
  .rvmrc
@@ -1,21 +1,21 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2017-10-04 14:22:21 -0400 using RuboCop version 0.47.1.
3
+ # on 2017-10-04 21:00:57 -0400 using RuboCop version 0.47.1.
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
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 3
9
+ # Offense count: 4
10
10
  # Configuration parameters: CountComments, ExcludedMethods.
11
11
  Metrics/BlockLength:
12
12
  Max: 38
13
13
 
14
- # Offense count: 5
14
+ # Offense count: 7
15
15
  # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
16
16
  # URISchemes: http, https
17
17
  Metrics/LineLength:
18
- Max: 135
18
+ Max: 143
19
19
 
20
20
  # Offense count: 6
21
21
  Style/Documentation:
@@ -1,3 +1,7 @@
1
+ ### 0.0.5 (10/5/2017)
2
+
3
+ * [#11](https://github.com/ashkan18/graphlient/pull/11): Fixed query argument types - [@ashkan18](https://github.com/ashkan18).
4
+
1
5
  ### 0.0.4 (10/4/2017)
2
6
 
3
7
  * [#8](https://github.com/ashkan18/graphlient/pull/8): Handle HTTP errors and raise `Graphlient::Errors::HTTP` on failure - [@dblock](https://github.com/dblock).
@@ -44,7 +44,22 @@ module Graphlient
44
44
  end
45
45
 
46
46
  def get_args_str(args)
47
- args.detect { |arg| arg.is_a? Hash }.map { |k, v| "#{k}: #{v}" }.join(',')
47
+ args.detect { |arg| arg.is_a? Hash }.map do |k, v|
48
+ "#{k}: #{get_arg_value_str(v)}"
49
+ end.join(', ')
50
+ end
51
+
52
+ def get_arg_value_str(value)
53
+ case value
54
+ when String
55
+ "\"#{value}\""
56
+ when Numeric
57
+ value.to_s
58
+ when Array
59
+ "[#{value.map { |v| get_arg_value_str(v) }.join(', ')}]"
60
+ else
61
+ value
62
+ end
48
63
  end
49
64
  end
50
65
  end
@@ -1,3 +1,3 @@
1
1
  module Graphlient
2
- VERSION = '0.0.4'.freeze
2
+ VERSION = '0.0.5'.freeze
3
3
  end
@@ -26,7 +26,20 @@ describe Graphlient::Query do
26
26
  line_items(name: 'test')
27
27
  end
28
28
  end
29
- expect(query.to_s).to eq "{ \ninvoice(id: 10){\n line_items(name: test)\n }\n }"
29
+ expect(query.to_s).to eq "{ \ninvoice(id: 10){\n line_items(name: \"test\")\n }\n }"
30
+ end
31
+
32
+ it 'returns expected query with block and local variables with proper type' do
33
+ int_arg = 10
34
+ float_arg = 10.3
35
+ str_arg = 'new name'
36
+ array_arg = ['str_item', 2]
37
+ query = Graphlient::Query.new do
38
+ invoice(id: int_arg, threshold: float_arg, item_list: array_arg) do
39
+ line_items(name: str_arg)
40
+ end
41
+ end
42
+ expect(query.to_s).to eq "{ \ninvoice(id: 10, threshold: 10.3, item_list: [\"str_item\", 2]){\n line_items(name: \"new name\")\n }\n }"
30
43
  end
31
44
  end
32
45
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphlient
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ashkan Nasseri
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-04 00:00:00.000000000 Z
11
+ date: 2017-10-05 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: ashkan.nasseri@gmail.com
@@ -26,7 +26,6 @@ files:
26
26
  - CHANGELOG.md
27
27
  - CONTRIBUTING.md
28
28
  - Gemfile
29
- - Gemfile.lock
30
29
  - LICENSE
31
30
  - README.md
32
31
  - RELEASING.md
@@ -66,7 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
66
65
  version: 1.3.6
67
66
  requirements: []
68
67
  rubyforge_project:
69
- rubygems_version: 2.5.1
68
+ rubygems_version: 2.6.12
70
69
  signing_key:
71
70
  specification_version: 4
72
71
  summary: Ruby Gem for consuming GraphQL endpoints
@@ -1,64 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- graphlient (0.0.4)
5
-
6
- GEM
7
- remote: http://rubygems.org/
8
- specs:
9
- addressable (2.5.2)
10
- public_suffix (>= 2.0.2, < 4.0)
11
- ast (2.3.0)
12
- byebug (9.1.0)
13
- crack (0.4.3)
14
- safe_yaml (~> 1.0.0)
15
- diff-lcs (1.3)
16
- hashdiff (0.3.6)
17
- parser (2.4.0.0)
18
- ast (~> 2.2)
19
- powerpack (0.1.1)
20
- public_suffix (3.0.0)
21
- rainbow (2.2.2)
22
- rake
23
- rake (12.1.0)
24
- rspec (3.6.0)
25
- rspec-core (~> 3.6.0)
26
- rspec-expectations (~> 3.6.0)
27
- rspec-mocks (~> 3.6.0)
28
- rspec-core (3.6.0)
29
- rspec-support (~> 3.6.0)
30
- rspec-expectations (3.6.0)
31
- diff-lcs (>= 1.2.0, < 2.0)
32
- rspec-support (~> 3.6.0)
33
- rspec-mocks (3.6.0)
34
- diff-lcs (>= 1.2.0, < 2.0)
35
- rspec-support (~> 3.6.0)
36
- rspec-support (3.6.0)
37
- rubocop (0.47.1)
38
- parser (>= 2.3.3.1, < 3.0)
39
- powerpack (~> 0.1)
40
- rainbow (>= 1.99.1, < 3.0)
41
- ruby-progressbar (~> 1.7)
42
- unicode-display_width (~> 1.0, >= 1.0.1)
43
- ruby-progressbar (1.9.0)
44
- safe_yaml (1.0.4)
45
- unicode-display_width (1.3.0)
46
- webmock (3.0.1)
47
- addressable (>= 2.3.6)
48
- crack (>= 0.3.2)
49
- hashdiff
50
-
51
- PLATFORMS
52
- ruby
53
-
54
- DEPENDENCIES
55
- byebug
56
- graphlient!
57
- rake
58
- rspec
59
- rspec-mocks
60
- rubocop (~> 0.47.1)
61
- webmock
62
-
63
- BUNDLED WITH
64
- 1.15.4