Skip to content

Commit 509b56e

Browse files
authored
Merge pull request #20 from contentstack/bug/class-extension
Monkey Patch for Ruby classes removed
2 parents 19a4b99 + 90514f6 commit 509b56e

File tree

11 files changed

+127
-106
lines changed

11 files changed

+127
-106
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
## CHANGELOG
2+
------------------------------------------------
3+
## Version 0.4.3
4+
### Date: 17th-Sept-2021
5+
### Dependency update
6+
- Issue for Monkey patching resolved. Implemented Refine to extend class within module scope.
7+
28
------------------------------------------------
39
## Version 0.4.2
410
### Date: 2nd-Sept-2021

lib/contentstack.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
require "contentstack/client"
55
require "contentstack/region"
66
require "contentstack_utils"
7-
require "util"
8-
97

108
# == Contentstack - Ruby SDK
119
# Contentstack is a content management system that facilitates the process of publication by separating the content from site-related programming and design.

lib/contentstack/api.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
require 'active_support'
44
require 'active_support/json'
55
require 'open-uri'
6-
6+
require 'util'
77
module Contentstack
88
class API
9+
using Utility
910
def self.init_api(api_key, delivery_token, environment,host)
1011
@host = host
1112
@api_version = '/v3'

lib/contentstack/asset.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
require 'util'
12
module Contentstack
23

34
# Asset class to fetch file details on Conentstack server.
45
class Asset
6+
using Utility
57
attr_reader :uid, :content_type, :filename, :file_size, :tags, :url
68

79
# @!attribute [r] uid

lib/contentstack/asset_collection.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
require 'contentstack/asset'
2+
require 'util'
23

34
module Contentstack
45
# Asset class to fetch details of files on Conentstack server.
56
class AssetCollection
7+
using Utility
68
attr_reader :assets
79

810
def initialize(assets_array=nil)

lib/contentstack/content_type.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
require 'contentstack/query'
2+
require 'util'
23

34
module Contentstack
45
class ContentType
6+
using Utility
57
[:title, :uid, :created_at, :updated_at, :attributes].each do |method_name|
68
if [:created_at, :updated_at].include?(method_name)
79
define_method method_name do

lib/contentstack/entry.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
require 'active_support/core_ext'
2+
require 'util'
23

34
module Contentstack
45
class Entry
6+
using Utility
57
attr_reader :fields, :content_type, :uid, :owner, :query, :schema, :content_type
68
def initialize(attrs, content_type_uid=nil)
79
setup(attrs, content_type_uid)

lib/contentstack/entry_collection.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
require 'contentstack/entry'
2+
require 'util'
23

34
module Contentstack
45
class EntryCollection
6+
using Utility
57
attr_reader :entries, :count, :content_type, :schema
68

79
def initialize(json, content_type_uid=nil)

lib/contentstack/query.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
require 'contentstack/entry_collection'
2+
require 'util'
23

34
module Contentstack
45
# A class that defines a query that is used to query for Entry instance.
56
class Query
7+
using Utility
68
# @!attribute [r] query
79
# Attribute which has all the information about the query which will be executed against Contentstack API
810

lib/contentstack/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module Contentstack
2-
VERSION = "0.4.2"
2+
VERSION = "0.4.3"
33
end

0 commit comments

Comments
 (0)