widgets_api_client 0.1.0.8 → 0.1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b841af1a95b326aec6b3588527f266c6bd189778
4
- data.tar.gz: 071abf7f7cfc54c63f6994a2888df7fe4aaa0c8e
3
+ metadata.gz: 7f6395196c2b2e74cc6bb7aa6f4557b286c7bd95
4
+ data.tar.gz: a3df4113899f7d1e8679cad877d61a377d52895a
5
5
  SHA512:
6
- metadata.gz: 62e86f042dcd7b81895549394b92c80dfedde41d5a9a4e7845e33d33f7c845819fb9495188d17423454182a786a95d6f79c380da658acfa318134f74d9329e04
7
- data.tar.gz: 4fb62efb6ba3cd65510153322ebebc7cc0ffeda63f88fa82798ccbc98f2e74210c9ef2d1e51f2b257b51cf52c908221e20f1d84cc7192d70c65191d5daa258a5
6
+ metadata.gz: 7f2b42a73ca1f7acbe201f987ada7ca9ad9a9ddbdd6b73cf90723e8f2edb7d25a0e6fb63315a846d854cf00266d60c97e71f615ad076a522fde1aff710903896
7
+ data.tar.gz: 540b8708fd3c9b9f15f668db4645a55d19fcf7e866a9e21ca62a12b461a26cd1e7880b3d8f7438caf31016d5665722efd9d269589bbe4e123a5fd4f49f84e663
data/Gemfile CHANGED
@@ -3,9 +3,6 @@ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
3
3
  gem 'rspec', :require => 'spec'
4
4
  gem 'rest-client'
5
5
  gem 'json'
6
- gem 'activemodel'
7
- gem 'activemodel-serializers-xml'
8
- gem 'active_model_serializers'
9
6
 
10
7
  group :test do
11
8
  gem 'simplecov', require: false
data/lib/domain/widget.rb CHANGED
@@ -1,51 +1,34 @@
1
1
  require 'json'
2
-
3
- #
4
- # Widget model conatining widget craeate and update attributes
5
- #
6
2
  class Widget
7
- attr_accessor :name
8
- attr_accessor :description
9
- attr_accessor :kind
3
+ attr_accessor :name
4
+ attr_accessor :description
5
+ attr_accessor :kind
10
6
 
11
- #
12
- # Inialise the widget model
13
- #
14
- # @param [String] name Name of widget
15
- # @param [String] description
16
- # @param [String] kind Kind of widget - hidden/visible
17
- #
18
- def initialize(name: nil, description: nil, kind: nil)
19
- self.name = name
20
- self.description = description
21
- self.kind = kind
22
- end
7
+ def initialize name: nil, description: nil, kind: nil
8
+ self.name, self.description, self.kind =
9
+ name, description, kind
10
+ end
23
11
 
24
- #
25
- # Converts Widget object to Json object
26
- #
27
- # @param [refrence] *data widget object refrence
28
- #
29
- # @return [<Type>] Json represenatation of widget object
30
- #
31
- def to_json(*data)
32
- hash = {
12
+ def to_json(*a)
13
+ hash = {
33
14
  name: @name,
34
15
  description: @description,
35
16
  kind: @kind
36
- }.to_h
37
- hash.delete_if { |k, v| v.nil? }
38
- hash.to_json(*data)
17
+ }
18
+ hash.delete_if { |k, v| v.nil? || v.empty? }
19
+ hash.to_json(*a)
39
20
  end
40
21
 
41
- #
42
- # Gets Json represenatation of widget object
43
- #
44
- # @param [Object] widget Widget object
45
- #
46
- # @return [Json] Json represenatation of widget object
47
- #
22
+ def self.json_create(o)
23
+ b_from_json = new
24
+ b_from_json.name = o['name']
25
+ b_from_json.description = o['description']
26
+ b_from_json.kind = o['kind']
27
+ b_from_json
28
+ end
29
+
48
30
  def self.get_payload(widget)
49
- widget.to_json
31
+ return widget.to_json
50
32
  end
51
- end
33
+
34
+ end
@@ -1,21 +1,16 @@
1
1
  require 'json'
2
-
3
- #
4
- # Widget Base class containing widget object
5
- #
6
2
  class WidgetBase
7
- attr_accessor :widget
3
+ attr_accessor :widget
8
4
 
9
- #
10
- # Converts Widget object to Json object
11
- #
12
- # @param [Refrence] *data widget object refrence
13
- #
14
- # @return [Json] Json represenatation of widget object
15
- #
16
- def to_json(*data)
17
- {
18
- widget: @widget
19
- }.to_json(*data)
5
+ def to_json(*a)
6
+ {
7
+ widget: @widget
8
+ }.to_json(*a)
9
+ end
10
+
11
+ def self.json_create(o)
12
+ a_from_json = new
13
+ a_from_json.widget = o['widget']
14
+ a_from_json
20
15
  end
21
- end
16
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: widgets_api_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.8
4
+ version: 0.1.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sachin Murthy