We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b05e2a9 commit 875a525Copy full SHA for 875a525
2 files changed
lib/contentstack/request.rb
@@ -8,6 +8,7 @@ class Request
8
attr_reader :endpoint
9
10
def initialize(client, endpoint)
11
+ # puts endpoint
12
@client = client
13
@endpoint = endpoint
14
end
lib/contentstack/utils.rb
@@ -0,0 +1,17 @@
1
+require 'ostruct'
2
+require 'json'
3
+
4
+module Contentstack
5
+ module Utils
6
7
+ module_function
+ # Simple way to turn a deeply nested hash into an openstruct
+ # https://coderwall.com/p/74rajw/convert-a-complex-nested-hash-to-an-object
+ def to_openstruct(hash)
+ json = hash.to_json
+ JSON.parse(json, object_class: OpenStruct)
+ end
15
16
17
+end
0 commit comments