example/example.rb in ruby-upwork-oauth2-2.1.3 vs example/example.rb in ruby-upwork-oauth2-2.1.4
- old
+ new
@@ -3,10 +3,11 @@
$:.unshift '../lib'
$LOAD_PATH << File.dirname(__FILE__)
require 'upwork/api'
+require 'upwork/api/routers/graphql'
require 'upwork/api/routers/auth'
require 'upwork/api/routers/messages'
require 'upwork/api/routers/reports/time'
require 'upwork/api/routers/freelancers/search'
@@ -40,9 +41,27 @@
# WARNING: the access token will be refreshed automatically for you
# in case it's expired, i.e. expires_at < time(). Make sure you replace the
# old token accordingly in your security storage. Call client.get_actual_config
# periodically to sync-up the data
@actual_access_token_data = client.get_actual_config
+
+# execute graphql request
+#client.set_org_uid_header('1234567890') # Organization UID (optional)
+#graphql = Upwork::Api::Routers::Graphql.new(client)
+#params = {
+# 'query' => "query {
+# user {
+# id
+# nid
+# rid
+# }
+# organization {
+# id
+# }
+# }"
+#}
+#data = graphql.execute params
+#p data['data']['user']['id']
# get my auth data
#auth = Upwork::Api::Routers::Auth.new(client)
#info = auth.get_user_info
#p info['server_time']