crowdskout 0.0.19 → 0.0.20

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: 50833641606d1c130260e26597621d67419eeb39
4
- data.tar.gz: 884d05d051fbfdd89aabf3819b31541489725d06
3
+ metadata.gz: f5a9480ecb623e28ed0f00839dae2361e1359bbc
4
+ data.tar.gz: 9584ea92cef3d1dd67afeb82dbe19ded1dbf8c1d
5
5
  SHA512:
6
- metadata.gz: 5c6f6487e9faa10114a68630b515c671088e93a3d3c707bd243104f297961c67fb7befd60d9a7647e9c50036d147aa3ae7c5626921c50c1263570581c79bda08
7
- data.tar.gz: b41ced3f90a49cb0b9260887c81f3c9311ee45717686d4f18da2a149fe9028dd83880ce21adc07cc1cc331931dc9cffd1212f27e84b4a83f6e1c7f9f5a1cda7c
6
+ metadata.gz: a81783f7a8bfa1dfcd6dd22b5a7814705795b77b9bcc4f1af79df5f15e4d26af03b6b68535133d51dd3c76e3954c178e006a5e0624c1e0e80270471671a40850
7
+ data.tar.gz: b1331c76ac56f973e55fe63e07b918dc02e01b6fe8816ec2e156877e7e7c446e9de6a974281704199f8293fb6a1ece403545b2e34c1c5c1d2378b2c2c884e7fc
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "crowdskout"
8
- s.version = '0.0.19'
8
+ s.version = '0.0.20'
9
9
  s.platform = Gem::Platform::RUBY
10
10
  s.authors = ["Crowdskout", "Revv","Kyle Schutt"]
11
11
  s.homepage = "https://github.com/revvco/crowdskout"
@@ -16,7 +16,13 @@ module Crowdskout
16
16
  obj = Value.new
17
17
  if props
18
18
  props.each do |key, value|
19
- obj.send("#{key}=", value) if obj.respond_to? key
19
+ if obj.respond_to? key
20
+ obj.send("#{key}=", value)
21
+ else
22
+ # this will create the attribute if it doesn't exist
23
+ obj.class.send(:attr_accessor, key)
24
+ obj.instance_variable_set("@#{key}", value)
25
+ end
20
26
  end
21
27
  end
22
28
  obj
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Crowdskout
22
- VERSION = '0.0.19'
22
+ VERSION = '0.0.20'
23
23
  end
@@ -46,4 +46,28 @@ describe Crowdskout::Components::Field do
46
46
  expect(JSON.parse(component.to_json)).to eq @hash
47
47
  end
48
48
  end
49
+ context "hash collection" do
50
+ before do
51
+ @json_string = %[{
52
+ "DonationParent" : {
53
+ "id" : "abcd-abcd-abcd-abcd",
54
+ "collection" : "PageViews"
55
+ }
56
+ }]
57
+ @hash = JSON.parse(@json_string)
58
+ end
59
+
60
+ it "creates a component" do
61
+ component = Crowdskout::Components::Field.create(@hash)
62
+ expect(component.key_name).to eq "DonationParent"
63
+ component.value.should be_kind_of(Crowdskout::Components::Value)
64
+ expect(component.value.id).to eq 'abcd-abcd-abcd-abcd'
65
+ expect(component.value.collection).to eq 'PageViews'
66
+ end
67
+ it "generates the correct json object" do
68
+ component = Crowdskout::Components::Field.create(@hash)
69
+ expect(JSON.parse(component.to_json)).to eq @hash
70
+ expect(component.to_json).to include 'collection'
71
+ end
72
+ end
49
73
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crowdskout
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.19
4
+ version: 0.0.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Crowdskout
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-04-03 00:00:00.000000000 Z
13
+ date: 2017-04-13 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rest-client