lolitado 0.1.2 → 0.1.3

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: bc56baf3b3dea55810b451e476acf813f48f43b75b8966319c260f479f82642d
4
- data.tar.gz: 56da4b3d1cff75fcb9b238a5022247877f31623b390066ad43795b9739adcbf4
3
+ metadata.gz: 1e3340ad161dcc24cdbdf7f33fb3a5d3320e2f1d803b62450aaea1c675ea22e9
4
+ data.tar.gz: 841aa2524c08929995ad31d1b327a5845ff6f9dc9d85640ed5de8231f26c8153
5
5
  SHA512:
6
- metadata.gz: 4319706e400e6710b11497611cf7830c5aa5fc059049851c041042928949b7f77b3eb69c2ec595879bf2db3887b6c4135351ece7bbf7049e760ca0082c0f21d7
7
- data.tar.gz: ebc0f3179d397207252685e615e5f4471dfa7a752c96976b372e70b89dac2f57af40084323fda0db673524469acc5c834f7fa07399bad4484b5d6cdd9b6b3706
6
+ metadata.gz: e03f1347e053cd101482de80c4cdc19c4f7ab7a707f21445a988d53490b1bdd570ebbfb4fc80fd1c9e1721fce697cefdd5859ff0748149147fd8c1545493a0bd
7
+ data.tar.gz: feb5d8b78188e22ae3afb1c591873bf2b0b85672b4565245a94d547099f5f5d4797c0f3f72d2c074b00904292b75961162cd3ee03d56a2c0bd58b38c1a943849
@@ -10,7 +10,9 @@ module Lolitado
10
10
  # @param msecs [Float] benchmark for api response time
11
11
  #
12
12
  def self.format_response response, msecs
13
- return {:response => response, :message => response.parsed_response, :status => response.code, :duration => msecs}
13
+ new_response = {:response => response, :message => response.parsed_response, :status => response.code, :duration => msecs}
14
+ response_with_hash_key = JSON.parse(JSON[new_response], symbolize_names: true)
15
+ return response_with_hash_key
14
16
  end
15
17
 
16
18
  #
@@ -37,6 +39,7 @@ module Lolitado
37
39
  end
38
40
  finish = Time.now
39
41
  msecs = (finish - start) * 1000.0
42
+ clear_headers
40
43
  # puts "RESPONSE - #{msecs}"
41
44
  return self.format_response(response, msecs)
42
45
  end
@@ -58,6 +61,13 @@ module Lolitado
58
61
  def self.new_headers
59
62
  return @new_headers
60
63
  end
64
+
65
+ #
66
+ # clear headers
67
+ #
68
+ def self.clear_headers
69
+ API.new_headers.clear unless API.new_headers.nil?
70
+ end
61
71
  end
62
72
 
63
73
  class Graph < API
@@ -71,7 +81,7 @@ module Lolitado
71
81
  # @param variables [String] input variables for graph query using
72
82
  #
73
83
  def self.request query, variables = false
74
- super(:post, '/', generate_body(query, variables))
84
+ super(:post, '', generate_body(query, variables))
75
85
  end
76
86
 
77
87
  #
@@ -90,7 +100,9 @@ module Lolitado
90
100
  else
91
101
  message = {'errors'=>response.parsed_response}
92
102
  end
93
- return {:response => response, :message => message, :status => response.code, :duration => msecs}
103
+ new_response = {:response => response, :message => message, :status => response.code, :duration => msecs}
104
+ response_with_hash_key = JSON.parse(JSON[new_response], symbolize_names: true)
105
+ return response_with_hash_key
94
106
  end
95
107
 
96
108
  #
@@ -103,7 +115,8 @@ module Lolitado
103
115
  body = {}
104
116
  body['query'] = query
105
117
  if variables
106
- if query.include?('$input')
118
+ variable_indices = query.enum_for(:scan, /(?=\$.*:)/).map { Regexp.last_match.offset(0).first }
119
+ if query.include?('$input') && variable_indices.to_a.length == 1
107
120
  body['variables'] = {'input'=>variables}
108
121
  else
109
122
  body['variables'] = variables
@@ -1,3 +1,3 @@
1
1
  module Lolitado
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,11 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lolitado
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dolores Zhang
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
  date: 2018-12-14 00:00:00.000000000 Z
@@ -88,7 +88,7 @@ homepage: http://github.com/doloreszhang/lolitado
88
88
  licenses:
89
89
  - MIT
90
90
  metadata: {}
91
- post_install_message:
91
+ post_install_message:
92
92
  rdoc_options: []
93
93
  require_paths:
94
94
  - lib
@@ -103,8 +103,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
103
  - !ruby/object:Gem::Version
104
104
  version: '0'
105
105
  requirements: []
106
- rubygems_version: 3.0.6
107
- signing_key:
106
+ rubyforge_project:
107
+ rubygems_version: 2.7.6
108
+ signing_key:
108
109
  specification_version: 4
109
110
  summary: Lolitado DSL for database process
110
111
  test_files: []