populr 0.1.12 → 0.1.13
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.
- data/VERSION +1 -1
- data/lib/asset.rb +1 -1
- data/lib/embed_asset.rb +1 -1
- data/populr.gemspec +2 -2
- data/spec/restful_model_collection_spec.rb +45 -0
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.13
|
data/lib/asset.rb
CHANGED
@@ -6,7 +6,7 @@ class Asset < RestfulModel
|
|
6
6
|
attr_accessor :title
|
7
7
|
|
8
8
|
# as an alternative to calling Asset.new, you can call populr.images.build
|
9
|
-
def initialize(parent, file, title = nil, description = nil)
|
9
|
+
def initialize(parent = nil, file = nil, title = nil, description = nil)
|
10
10
|
super(parent)
|
11
11
|
|
12
12
|
@file = file
|
data/lib/embed_asset.rb
CHANGED
@@ -9,7 +9,7 @@ class EmbedAsset < Asset
|
|
9
9
|
end
|
10
10
|
|
11
11
|
# as an alternative to calling Asset.new, you can call populr.images.build
|
12
|
-
def initialize(parent, source_html, title = nil, description = nil)
|
12
|
+
def initialize(parent = nil, source_html = nil, title = nil, description = nil)
|
13
13
|
super(parent, nil)
|
14
14
|
|
15
15
|
@source_html = source_html
|
data/populr.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "populr"
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.13"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Ben Gotow"]
|
12
|
-
s.date = "
|
12
|
+
s.date = "2014-02-03"
|
13
13
|
s.description = "Gem for interacting with the Populr.me API that allows you to create and publish one-page websites, subscribe to web hooks and receive events when those pages are interacted with. Visit http://www.populr.me/ for more information. "
|
14
14
|
s.email = "ben@populr.me"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -35,6 +35,51 @@ describe 'RestfulModelCollection' do
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
+
context "on an image asset" do
|
39
|
+
before (:each) do
|
40
|
+
result = double('result')
|
41
|
+
result.stub(:code).and_return(200)
|
42
|
+
RestClient.should_receive(:get).and_yield("{\"_id\":\"5107089add02dcaecc000003\",\"created_at\":\"2013-01-28T23:24:10Z\",\"domain\":\"generic\",\"name\":\"Untitled\",\"password\":null,\"slug\":\"\",\"tracers\":[{\"_id\":\"5109b5e0dd02dc5976000001\",\"created_at\":\"2013-01-31T00:08:00Z\",\"name\":\"Facebook\"},{\"_id\":\"5109b5f5dd02dc4c43000002\",\"created_at\":\"2013-01-31T00:08:21Z\",\"name\":\"Twitter\"}],\"published_pop_url\":\"http://group3.lvh.me\",\"unpopulated_api_tags\":[],\"unpopulated_api_regions\":[],\"label_names\":[]}", nil, result)
|
43
|
+
@collection = @populr.images
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should return an image asset" do
|
47
|
+
pop = @collection.find('5107089add02dcaecc000003')
|
48
|
+
pop.is_a?(ImageAsset).should == true
|
49
|
+
pop._id.should == '5107089add02dcaecc000003'
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
context "on a document asset" do
|
54
|
+
before (:each) do
|
55
|
+
result = double('result')
|
56
|
+
result.stub(:code).and_return(200)
|
57
|
+
RestClient.should_receive(:get).and_yield("{\"_id\":\"5107089add02dcaecc000003\",\"created_at\":\"2013-01-28T23:24:10Z\",\"domain\":\"generic\",\"name\":\"Untitled\",\"password\":null,\"slug\":\"\",\"tracers\":[{\"_id\":\"5109b5e0dd02dc5976000001\",\"created_at\":\"2013-01-31T00:08:00Z\",\"name\":\"Facebook\"},{\"_id\":\"5109b5f5dd02dc4c43000002\",\"created_at\":\"2013-01-31T00:08:21Z\",\"name\":\"Twitter\"}],\"published_pop_url\":\"http://group3.lvh.me\",\"unpopulated_api_tags\":[],\"unpopulated_api_regions\":[],\"label_names\":[]}", nil, result)
|
58
|
+
@collection = @populr.documents
|
59
|
+
end
|
60
|
+
|
61
|
+
it "should return a document asset" do
|
62
|
+
pop = @collection.find('5107089add02dcaecc000003')
|
63
|
+
pop.is_a?(DocumentAsset).should == true
|
64
|
+
pop._id.should == '5107089add02dcaecc000003'
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
context "on an embed asset" do
|
69
|
+
before (:each) do
|
70
|
+
result = double('result')
|
71
|
+
result.stub(:code).and_return(200)
|
72
|
+
RestClient.should_receive(:get).and_yield("{\"_id\":\"5107089add02dcaecc000003\",\"created_at\":\"2013-01-28T23:24:10Z\",\"domain\":\"generic\",\"name\":\"Untitled\",\"password\":null,\"slug\":\"\",\"tracers\":[{\"_id\":\"5109b5e0dd02dc5976000001\",\"created_at\":\"2013-01-31T00:08:00Z\",\"name\":\"Facebook\"},{\"_id\":\"5109b5f5dd02dc4c43000002\",\"created_at\":\"2013-01-31T00:08:21Z\",\"name\":\"Twitter\"}],\"published_pop_url\":\"http://group3.lvh.me\",\"unpopulated_api_tags\":[],\"unpopulated_api_regions\":[],\"label_names\":[]}", nil, result)
|
73
|
+
@collection = @populr.embeds
|
74
|
+
end
|
75
|
+
|
76
|
+
it "should return an embed asset" do
|
77
|
+
pop = @collection.find('5107089add02dcaecc000003')
|
78
|
+
pop.is_a?(EmbedAsset).should == true
|
79
|
+
pop._id.should == '5107089add02dcaecc000003'
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
38
83
|
it "should return nil and not throw an exception if you fail to pass an ID" do
|
39
84
|
@populr.pops.find(nil).should == nil
|
40
85
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: populr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.13
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2014-02-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|
@@ -208,7 +208,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
208
208
|
version: '0'
|
209
209
|
segments:
|
210
210
|
- 0
|
211
|
-
hash:
|
211
|
+
hash: 3478582634502262912
|
212
212
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
213
213
|
none: false
|
214
214
|
requirements:
|