diff --git a/CHANGELOG.md b/CHANGELOG.md
index a85ef09..67b5712 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,10 @@
## CHANGELOG
+------------------------------------------------
+## Version 0.4.3
+### Date: 17th-Sept-2021
+ ### Dependency update
+ - Issue for Monkey patching resolved. Implemented Refine to extend class within module scope.
+
------------------------------------------------
## Version 0.4.2
### Date: 2nd-Sept-2021
diff --git a/coverage/.last_run.json b/coverage/.last_run.json
index 144e532..72254bd 100644
--- a/coverage/.last_run.json
+++ b/coverage/.last_run.json
@@ -1,5 +1,5 @@
{
"result": {
- "line": 96.71
+ "line": 96.78
}
}
diff --git a/coverage/.resultset.json b/coverage/.resultset.json
index 56af541..29a1a14 100644
--- a/coverage/.resultset.json
+++ b/coverage/.resultset.json
@@ -9,8 +9,6 @@
1,
1,
1,
- 1,
- null,
null,
null,
null,
@@ -53,6 +51,8 @@
1,
1,
1,
+ 1,
+ 1,
null,
1,
81,
@@ -120,7 +120,8 @@
1,
1,
1,
- null,
+ 1,
+ 1,
1,
1,
1,
@@ -181,13 +182,130 @@
null
]
},
+ "/Users/uttamukkoji/Documents/Contentstack/Ruby/contentstack-ruby/lib/util.rb": {
+ "lines": [
+ 1,
+ 1,
+ 1,
+ 1,
+ 93,
+ 365,
+ null,
+ null,
+ null,
+ 1,
+ 3628,
+ 3628,
+ 18741,
+ 3709,
+ null,
+ 15032,
+ null,
+ null,
+ 3628,
+ null,
+ null,
+ null,
+ 1,
+ 1,
+ 19,
+ 40,
+ null,
+ null,
+ 1,
+ 1487,
+ 1197,
+ 958,
+ null,
+ 239,
+ null,
+ null,
+ null,
+ null,
+ null,
+ 1,
+ 1,
+ 201,
+ 201,
+ null,
+ null,
+ 1,
+ 222,
+ null,
+ null,
+ null,
+ 1,
+ 1,
+ 0,
+ null,
+ null,
+ 1,
+ 335,
+ null,
+ null,
+ null,
+ 1,
+ 1,
+ 80,
+ null,
+ null,
+ 1,
+ 0,
+ null,
+ null,
+ null,
+ 1,
+ 1,
+ 0,
+ null,
+ null,
+ 1,
+ 18,
+ null,
+ null,
+ null,
+ 1,
+ 1,
+ 0,
+ null,
+ null,
+ 1,
+ 40,
+ null,
+ null,
+ null,
+ 1,
+ 1,
+ 0,
+ null,
+ null,
+ 1,
+ 97,
+ null,
+ null,
+ null,
+ 1,
+ 1,
+ 0,
+ null,
+ null,
+ 1,
+ 0,
+ null,
+ null,
+ null,
+ null
+ ]
+ },
"/Users/uttamukkoji/Documents/Contentstack/Ruby/contentstack-ruby/lib/contentstack/content_type.rb": {
"lines": [
+ 1,
1,
null,
1,
1,
1,
+ 1,
5,
2,
10,
@@ -239,11 +357,13 @@
},
"/Users/uttamukkoji/Documents/Contentstack/Ruby/contentstack-ruby/lib/contentstack/query.rb": {
"lines": [
+ 1,
1,
null,
1,
null,
1,
+ 1,
null,
null,
null,
@@ -873,11 +993,13 @@
},
"/Users/uttamukkoji/Documents/Contentstack/Ruby/contentstack-ruby/lib/contentstack/entry_collection.rb": {
"lines": [
+ 1,
1,
null,
1,
1,
1,
+ 1,
null,
1,
48,
@@ -920,12 +1042,14 @@
},
"/Users/uttamukkoji/Documents/Contentstack/Ruby/contentstack-ruby/lib/contentstack/entry.rb": {
"lines": [
+ 1,
1,
null,
1,
1,
1,
1,
+ 1,
229,
null,
null,
@@ -1131,12 +1255,14 @@
},
"/Users/uttamukkoji/Documents/Contentstack/Ruby/contentstack-ruby/lib/contentstack/asset_collection.rb": {
"lines": [
+ 1,
1,
null,
1,
null,
1,
1,
+ 1,
null,
1,
4,
@@ -1161,11 +1287,13 @@
},
"/Users/uttamukkoji/Documents/Contentstack/Ruby/contentstack-ruby/lib/contentstack/asset.rb": {
"lines": [
+ 1,
1,
null,
null,
1,
1,
+ 1,
null,
null,
null,
@@ -1274,117 +1402,6 @@
null
]
},
- "/Users/uttamukkoji/Documents/Contentstack/Ruby/contentstack-ruby/lib/util.rb": {
- "lines": [
- 1,
- 1,
- 93,
- 365,
- null,
- null,
- null,
- 1,
- 3628,
- 3628,
- 18741,
- 3709,
- null,
- 15032,
- null,
- null,
- 3628,
- null,
- null,
- null,
- 1,
- 1,
- 19,
- 40,
- null,
- null,
- 1,
- 1487,
- 1197,
- 958,
- null,
- 239,
- null,
- null,
- null,
- null,
- null,
- 1,
- 1,
- 201,
- 201,
- null,
- null,
- 1,
- 222,
- null,
- null,
- null,
- 1,
- 1,
- 0,
- null,
- null,
- 1,
- 335,
- null,
- null,
- null,
- 1,
- 1,
- 80,
- null,
- null,
- 1,
- 0,
- null,
- null,
- null,
- 1,
- 1,
- 0,
- null,
- null,
- 1,
- 18,
- null,
- null,
- null,
- 1,
- 1,
- 0,
- null,
- null,
- 1,
- 40,
- null,
- null,
- null,
- 1,
- 1,
- 0,
- null,
- null,
- 1,
- 97,
- null,
- null,
- null,
- 1,
- 1,
- 0,
- null,
- null,
- 1,
- 0,
- null,
- null
- ]
- },
"/Users/uttamukkoji/Documents/Contentstack/Ruby/contentstack-ruby/spec/asset_spec.rb": {
"lines": [
1,
@@ -1943,6 +1960,6 @@
]
}
},
- "timestamp": 1630385582
+ "timestamp": 1631696451
}
}
diff --git a/coverage/index.html b/coverage/index.html
index d7878b0..e93ff24 100644
--- a/coverage/index.html
+++ b/coverage/index.html
@@ -14,7 +14,7 @@
require "util"
-
-
+ require 'util'
using Utility
+
+
+
+ def self.init_api(api_key, delivery_token, environment,host)
module Contentstack
+ require 'util'
+ module Contentstack
# Asset class to fetch file details on Conentstack server.
+
class Asset
+ # Asset class to fetch file details on Conentstack server.
attr_reader :uid, :content_type, :filename, :file_size, :tags, :url
+ class Asset
+ using Utility
# @!attribute [r] uid
+ attr_reader :uid, :content_type, :filename, :file_size, :tags, :url
# Contentstack Asset UID for this asset
+
@@ -1546,7 +1535,7 @@
+ # @!attribute [r] uid
@@ -1557,7 +1546,7 @@ # @!attribute [r] content_type
+ # Contentstack Asset UID for this asset
@@ -1568,7 +1557,7 @@ # Content Type for the asset. image/png, image/jpeg, application/pdf, video/mp4 etc.
+
@@ -1579,7 +1568,7 @@
+ # @!attribute [r] content_type
@@ -1590,7 +1579,7 @@ # @!attribute [r] filename
+ # Content Type for the asset. image/png, image/jpeg, application/pdf, video/mp4 etc.
@@ -1601,7 +1590,7 @@ # Name of the asset.
+
@@ -1612,7 +1601,7 @@
+ # @!attribute [r] filename
@@ -1623,7 +1612,7 @@ # @!attribute [r] file_size
+ # Name of the asset.
@@ -1634,7 +1623,7 @@ # Size of the asset.
+
@@ -1645,7 +1634,7 @@
+ # @!attribute [r] file_size
@@ -1656,7 +1645,7 @@ # @!attribute [r] tags
+ # Size of the asset.
@@ -1667,7 +1656,7 @@ # Array of tags assigned to the asset.
+
@@ -1678,7 +1667,7 @@
+ # @!attribute [r] tags
@@ -1689,7 +1678,7 @@ # @!attribute [r] url
+ # Array of tags assigned to the asset.
@@ -1700,7 +1689,7 @@ # URL to fetch/render the asset
+
@@ -1711,7 +1700,7 @@
+ # @!attribute [r] url
@@ -1722,7 +1711,7 @@ # Create instance of an Asset. Accepts either a uid of asset (String) or a complete asset JSON
+ # URL to fetch/render the asset
@@ -1733,7 +1722,7 @@ # @param [String/Hash] attrs
+
@@ -1744,7 +1733,7 @@ # Usage for String parameter
+ # Create instance of an Asset. Accepts either a uid of asset (String) or a complete asset JSON
@@ -1755,7 +1744,7 @@ # @asset = @stack.asset("some_asset_uid")
+ # @param [String/Hash] attrs
@@ -1766,7 +1755,7 @@ # @asset.fetch
+ # Usage for String parameter
@@ -1777,7 +1766,7 @@ #
+ # @asset = @stack.asset("some_asset_uid")
@@ -1788,7 +1777,7 @@ # Usage for Hash parameter
+ # @asset.fetch
@@ -1799,7 +1788,7 @@ # @asset = @stack.asset({
+ #
@@ -1810,7 +1799,7 @@ # :uid => "some_asset_uid",
+ # Usage for Hash parameter
@@ -1821,7 +1810,7 @@ # :content_type => "file_type", # image/png, image/jpeg, application/pdf, video/mp4 etc.
+ # @asset = @stack.asset({
@@ -1832,7 +1821,7 @@ # :filename => "some_file_name",
+ # :uid => "some_asset_uid",
@@ -1843,7 +1832,7 @@ # :file_size => "some_file_size",
+ # :content_type => "file_type", # image/png, image/jpeg, application/pdf, video/mp4 etc.
@@ -1854,7 +1843,7 @@ # :tags => ["tag1", "tag2", "tag3"],
+ # :filename => "some_file_name",
@@ -1865,7 +1854,7 @@ # :url => "file_url"
+ # :file_size => "some_file_size",
@@ -1876,7 +1865,7 @@ # })
+ # :tags => ["tag1", "tag2", "tag3"],
@@ -1887,12 +1876,34 @@ # :url => "file_url"
+
+
+
+ # })
+ # @asset.fetch
require 'util'
+ using Utility
+ module Contentstack
+ require 'util'
class Client
+ module Contentstack
@@ -2609,12 +2642,34 @@ class Client
+
+
+
+ using Utility
+ attr_reader :region, :host
require 'util'
+ using Utility
+ require 'util'
+ using Utility
+
+ require 'util'
module Contentstack
+
class EntryCollection
+ module Contentstack
@@ -6244,12 +6343,34 @@ attr_reader :entries, :count, :content_type, :schema
+ class EntryCollection
using Utility
+ attr_reader :entries, :count, :content_type, :schema
+ require 'util'
+ using Utility
+ VERSION = "0.4.1"
+ VERSION = "0.4.3"
class Hash
+ module Contentstack
@@ -14198,1156 +14341,1200 @@ def to_query(namespace = nil)
+ module Utility
+
+
+
+ refine Hash do
+ def to_query(namespace = nil)
collect do |key, value|
+ collect do |key, value|
value.to_query(namespace ? "#{namespace}[#{key}]" : key)
+ value.to_query(namespace ? "#{namespace}[#{key}]" : key)
end.sort * '&'
+ end.sort * '&'
end
+ end
+
def symbolize_keys
+ def symbolize_keys
new_hash = {}
+ new_hash = {}
self.each do |key,value|
+ self.each do |key,value|
if [Hash, Array].include?(value.class)
+ if [Hash, Array].include?(value.class)
new_hash[key.to_sym] = value.symbolize_keys
+ new_hash[key.to_sym] = value.symbolize_keys
else
+ else
new_hash[key.to_sym] = value
+ new_hash[key.to_sym] = value
end
+ end
end
+ end
new_hash
+ new_hash
end
+ end
end
+ end
+
class Array
+ refine Array do
def to_query(key)
+ def to_query(key)
prefix = "#{key}[]"
+ prefix = "#{key}[]"
collect { |value| value.to_query(prefix) }.join '&'
+ collect { |value| value.to_query(prefix) }.join '&'
end
+ end
+
def symbolize_keys
+ def symbolize_keys
collect do |entry|
+ collect do |entry|
if entry.class == Hash
+ if entry.class == Hash
entry.symbolize_keys
+ entry.symbolize_keys
else
+ else
entry
+ entry
end
+ end
end
+ end
end
+ end
end
+ end
+
class String
+ refine String do
def to_query(key)
+ def to_query(key)
require 'cgi' unless defined?(CGI) && defined?(CGI::escape)
+ require 'cgi' unless defined?(CGI) && defined?(CGI::escape)
"#{CGI.escape(key.to_param)}=#{CGI.escape(to_param.to_s)}"
+ "#{CGI.escape(key.to_param)}=#{CGI.escape(to_param.to_s)}"
end
+ end
+
def to_param
+ def to_param
to_s
+ to_s
end
+ end
end
+ end
+
class Symbol
+ refine Symbol do
def to_query(key)
+ def to_query(key)
to_s.to_query(key)
+ to_s.to_query(key)
end
+ end
+
def to_param
+ def to_param
to_s
+ to_s
end
+ end
end
+ end
+
class NilClass
+ refine NilClass do
def to_query(key)
+ def to_query(key)
to_s.to_query(key)
+ to_s.to_query(key)
end
+ end
+
def to_param
+ def to_param
to_s
+ to_s
end
+ end
end
+ end
+
class TrueClass
+ refine TrueClass do
def to_query(key)
+ def to_query(key)
to_s.to_query(key)
+ to_s.to_query(key)
end
+ end
+
def to_query(val)
+ def to_query(val)
"#{CGI.escape(val.to_param)}=#{CGI.escape(to_s)}"
+ "#{CGI.escape(val.to_param)}=#{CGI.escape(to_s)}"
end
+ end
end
+ end
+
class FalseClass
+ refine FalseClass do
def to_query(key)
+ def to_query(key)
to_s.to_query(key)
+ to_s.to_query(key)
end
+ end
+
def to_query(val)
+ def to_query(val)
"#{CGI.escape(val.to_param)}=#{CGI.escape(to_s)}"
+ "#{CGI.escape(val.to_param)}=#{CGI.escape(to_s)}"
end
+ end
end
+ end
+
class Integer
+ refine Integer do
def to_query(key)
+ def to_query(key)
to_s.to_query(key)
+ to_s.to_query(key)
end
+ end
+
def to_query(val)
+ def to_query(val)
"#{CGI.escape(val.to_param)}=#{CGI.escape(to_s)}"
+ "#{CGI.escape(val.to_param)}=#{CGI.escape(to_s)}"
end
+ end
end
+ end
+
class Numeric
+ refine Numeric do
def to_query(key)
+ def to_query(key)
to_s.to_query(key)
+ to_s.to_query(key)
end
+ end
+
def to_query(val)
+ def to_query(val)
"#{CGI.escape(val.to_param)}=#{CGI.escape(to_s)}"
+ "#{CGI.escape(val.to_param)}=#{CGI.escape(to_s)}"
end
+ end
end
+ end
+