readypulse 0.0.1
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 +7 -0
- data/.gitignore +14 -0
- data/.rspec +2 -0
- data/.ruby-version +1 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/LICENSE.txt +22 -0
- data/README.md +31 -0
- data/Rakefile +2 -0
- data/docs/json_schema.md +296 -0
- data/lib/readypulse.rb +10 -0
- data/lib/readypulse/album.rb +30 -0
- data/lib/readypulse/client.rb +72 -0
- data/lib/readypulse/image.rb +72 -0
- data/lib/readypulse/image_collection.rb +35 -0
- data/lib/readypulse/image_type.rb +11 -0
- data/lib/readypulse/version.rb +3 -0
- data/readypulse.gemspec +27 -0
- data/spec/lib/readypulse/album_spec.rb +43 -0
- data/spec/lib/readypulse/client_spec.rb +45 -0
- data/spec/lib/readypulse/image_collection_spec.rb +24 -0
- data/spec/lib/readypulse/image_spec.rb +21 -0
- data/spec/lib/readypulse/image_type_spec.rb +15 -0
- data/spec/spec_helper.rb +97 -0
- metadata +157 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 98ce8b39ef5d2c2a6deb2fb2d2de1f78b9887b87
|
4
|
+
data.tar.gz: d0af05db892f0386c4bde350ecd6553f0b8a34ff
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2b10a928c2b8db0fb1f5448ad8798ee0249699fed46f5e40266ff6e0359d2ae08cd34acdeabd97801ed65fc70c983fbc749146a97ece788c934d605e98b7ac6d
|
7
|
+
data.tar.gz: 2936381a3aae7e0c7bc5fff1be2b8a8082764e3f92a2c9f308a66cab849c75332283836d110843c660aebf61b31b438e83ae37f9ef7c9b29fb42dd1c1afd415c
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-head
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Chad Metcalf
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
22
|
+
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Chad Metcalf
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# Readypulse
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'readypulse'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install readypulse
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
TODO: Write usage instructions here
|
24
|
+
|
25
|
+
## Contributing
|
26
|
+
|
27
|
+
1. Fork it ( https://github.com/[my-github-username]/readypulse/fork )
|
28
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
29
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
30
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
31
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/docs/json_schema.md
ADDED
@@ -0,0 +1,296 @@
|
|
1
|
+
```json
|
2
|
+
{
|
3
|
+
"type":"object",
|
4
|
+
"$schema": "http://json-schema.org/draft-03/schema",
|
5
|
+
"id": "http://jsonschema.net",
|
6
|
+
"required":false,
|
7
|
+
"properties":{
|
8
|
+
"brand": {
|
9
|
+
"type":"object",
|
10
|
+
"description": "Details of the brand that this collection is a part of.",
|
11
|
+
"id": "http://jsonschema.net/brand",
|
12
|
+
"required":true,
|
13
|
+
"properties":{
|
14
|
+
"id": {
|
15
|
+
"type":"number",
|
16
|
+
"id": "http://jsonschema.net/brand/id",
|
17
|
+
"required":false
|
18
|
+
},
|
19
|
+
"name": {
|
20
|
+
"type":"string",
|
21
|
+
"id": "http://jsonschema.net/brand/name",
|
22
|
+
"required":false
|
23
|
+
}
|
24
|
+
}
|
25
|
+
},
|
26
|
+
"content": {
|
27
|
+
"type":"array",
|
28
|
+
"description": "An Array of social posts or content.",
|
29
|
+
"id": "http://jsonschema.net/content",
|
30
|
+
"required":true,
|
31
|
+
"items":
|
32
|
+
{
|
33
|
+
"type":"object",
|
34
|
+
"id": "http://jsonschema.net/content/0",
|
35
|
+
"required":false,
|
36
|
+
"properties":{
|
37
|
+
"actor": {
|
38
|
+
"type":"object",
|
39
|
+
"description": "Details about the content creator",
|
40
|
+
"id": "http://jsonschema.net/content/0/actor",
|
41
|
+
"required":true,
|
42
|
+
"properties":{
|
43
|
+
"bio": {
|
44
|
+
"type":"null",
|
45
|
+
"id": "http://jsonschema.net/content/0/actor/bio",
|
46
|
+
"required":false
|
47
|
+
},
|
48
|
+
"handle_name": {
|
49
|
+
"type":"string",
|
50
|
+
"id": "http://jsonschema.net/content/0/actor/handle_name",
|
51
|
+
"required":false
|
52
|
+
},
|
53
|
+
"image_url": {
|
54
|
+
"type":"string",
|
55
|
+
"id": "http://jsonschema.net/content/0/actor/image_url",
|
56
|
+
"required":false
|
57
|
+
},
|
58
|
+
"name": {
|
59
|
+
"type":"string",
|
60
|
+
"id": "http://jsonschema.net/content/0/actor/name",
|
61
|
+
"required":false
|
62
|
+
},
|
63
|
+
"social_id": {
|
64
|
+
"type":"string",
|
65
|
+
"id": "http://jsonschema.net/content/0/actor/social_id",
|
66
|
+
"required":false
|
67
|
+
},
|
68
|
+
"url": {
|
69
|
+
"type":"string",
|
70
|
+
"id": "http://jsonschema.net/content/0/actor/url",
|
71
|
+
"required":false
|
72
|
+
}
|
73
|
+
}
|
74
|
+
},
|
75
|
+
"content_index": {
|
76
|
+
"type":"string",
|
77
|
+
"description": "The index in which the content is stored",
|
78
|
+
"id": "http://jsonschema.net/content/0/content_index",
|
79
|
+
"required":true
|
80
|
+
},
|
81
|
+
"content_source": {
|
82
|
+
"type":"string",
|
83
|
+
"description": "Source of the content",
|
84
|
+
"id": "http://jsonschema.net/content/0/content_source",
|
85
|
+
"required":true
|
86
|
+
},
|
87
|
+
"external_conversation_link": {
|
88
|
+
"type":"null",
|
89
|
+
"id": "http://jsonschema.net/content/0/external_conversation_link",
|
90
|
+
"required":false
|
91
|
+
},
|
92
|
+
"has_media": {
|
93
|
+
"type":"boolean",
|
94
|
+
"id": "http://jsonschema.net/content/0/has_media",
|
95
|
+
"required":false
|
96
|
+
},
|
97
|
+
"media": {
|
98
|
+
"type":"object",
|
99
|
+
"id": "http://jsonschema.net/content/0/media",
|
100
|
+
"required":false,
|
101
|
+
"properties":{
|
102
|
+
"images": {
|
103
|
+
"type":"array",
|
104
|
+
"id": "http://jsonschema.net/content/0/media/images",
|
105
|
+
"required":false,
|
106
|
+
"items":
|
107
|
+
{
|
108
|
+
"type":"object",
|
109
|
+
"id": "http://jsonschema.net/content/0/media/images/0",
|
110
|
+
"required":false,
|
111
|
+
"properties":{
|
112
|
+
"height": {
|
113
|
+
"type":"number",
|
114
|
+
"id": "http://jsonschema.net/content/0/media/images/0/height",
|
115
|
+
"required":false
|
116
|
+
},
|
117
|
+
"type": {
|
118
|
+
"type":"string",
|
119
|
+
"id": "http://jsonschema.net/content/0/media/images/0/type",
|
120
|
+
"required":false
|
121
|
+
},
|
122
|
+
"url": {
|
123
|
+
"type":"string",
|
124
|
+
"id": "http://jsonschema.net/content/0/media/images/0/url",
|
125
|
+
"required":false
|
126
|
+
},
|
127
|
+
"width": {
|
128
|
+
"type":"number",
|
129
|
+
"id": "http://jsonschema.net/content/0/media/images/0/width",
|
130
|
+
"required":false
|
131
|
+
}
|
132
|
+
}
|
133
|
+
}
|
134
|
+
|
135
|
+
|
136
|
+
}
|
137
|
+
}
|
138
|
+
},
|
139
|
+
"products": {
|
140
|
+
"type":"array",
|
141
|
+
"description": "List of Products associated with this content. Products are part of the eCommerce catalog that the brand has configured with ReadyPulse",
|
142
|
+
"id": "http://jsonschema.net/content/0/products",
|
143
|
+
"required":false,
|
144
|
+
"items":
|
145
|
+
{
|
146
|
+
"type":"object",
|
147
|
+
"id": "http://jsonschema.net/content/0/products/0",
|
148
|
+
"required":false,
|
149
|
+
"properties":{
|
150
|
+
"description": {
|
151
|
+
"type":"string",
|
152
|
+
"id": "http://jsonschema.net/content/0/products/0/description",
|
153
|
+
"required":false
|
154
|
+
},
|
155
|
+
"image": {
|
156
|
+
"type":"string",
|
157
|
+
"id": "http://jsonschema.net/content/0/products/0/image",
|
158
|
+
"required":false
|
159
|
+
},
|
160
|
+
"name": {
|
161
|
+
"type":"string",
|
162
|
+
"id": "http://jsonschema.net/content/0/products/0/name",
|
163
|
+
"required":false
|
164
|
+
},
|
165
|
+
"price": {
|
166
|
+
"type":"string",
|
167
|
+
"id": "http://jsonschema.net/content/0/products/0/price",
|
168
|
+
"required":false
|
169
|
+
},
|
170
|
+
"thumbnail_image_url": {
|
171
|
+
"type":"null",
|
172
|
+
"id": "http://jsonschema.net/content/0/products/0/thumbnail_image_url",
|
173
|
+
"required":false
|
174
|
+
},
|
175
|
+
"tiny_image_url": {
|
176
|
+
"type":"null",
|
177
|
+
"id": "http://jsonschema.net/content/0/products/0/tiny_image_url",
|
178
|
+
"required":false
|
179
|
+
},
|
180
|
+
"url": {
|
181
|
+
"type":"string",
|
182
|
+
"id": "http://jsonschema.net/content/0/products/0/url",
|
183
|
+
"required":false
|
184
|
+
}
|
185
|
+
}
|
186
|
+
}
|
187
|
+
},
|
188
|
+
"readypulse_content_score": {
|
189
|
+
"type":"number",
|
190
|
+
"id": "http://jsonschema.net/content/0/readypulse_content_score",
|
191
|
+
"required":false
|
192
|
+
},
|
193
|
+
"sentiment": {
|
194
|
+
"type":"string",
|
195
|
+
"id": "http://jsonschema.net/content/0/sentiment",
|
196
|
+
"required":false
|
197
|
+
},
|
198
|
+
"social_attributes": {
|
199
|
+
"type":"object",
|
200
|
+
"id": "http://jsonschema.net/content/0/social_attributes",
|
201
|
+
"required":false
|
202
|
+
},
|
203
|
+
"story_url": {
|
204
|
+
"type":"string",
|
205
|
+
"id": "http://jsonschema.net/content/0/story_url",
|
206
|
+
"required":false
|
207
|
+
},
|
208
|
+
"timestamp": {
|
209
|
+
"type":"string",
|
210
|
+
"id": "http://jsonschema.net/content/0/timestamp",
|
211
|
+
"required":false
|
212
|
+
},
|
213
|
+
"type": {
|
214
|
+
"type":"string",
|
215
|
+
"id": "http://jsonschema.net/content/0/type",
|
216
|
+
"required":false
|
217
|
+
},
|
218
|
+
"uniq_id": {
|
219
|
+
"type":"string",
|
220
|
+
"description": "The unique content ID within ReadyPulse indexes",
|
221
|
+
"id": "http://jsonschema.net/content/0/uniq_id",
|
222
|
+
"required":true
|
223
|
+
},
|
224
|
+
"id": {
|
225
|
+
"type":"string",
|
226
|
+
"description": "The unique content ID within ReadyPulse indexes. To be used with all ReadyPulse API calls.",
|
227
|
+
"id": "http://jsonschema.net/content/0/id",
|
228
|
+
"required":true
|
229
|
+
},
|
230
|
+
"user_text": {
|
231
|
+
"type":"string",
|
232
|
+
"id": "http://jsonschema.net/content/0/user_text",
|
233
|
+
"required":false
|
234
|
+
}
|
235
|
+
}
|
236
|
+
}
|
237
|
+
|
238
|
+
|
239
|
+
},
|
240
|
+
"created_at": {
|
241
|
+
"type":"string",
|
242
|
+
"id": "http://jsonschema.net/created_at",
|
243
|
+
"required":false
|
244
|
+
},
|
245
|
+
"description": {
|
246
|
+
"type":"string",
|
247
|
+
"id": "http://jsonschema.net/description",
|
248
|
+
"required":false
|
249
|
+
},
|
250
|
+
"id": {
|
251
|
+
"type":"number",
|
252
|
+
"description": "ID of the collection",
|
253
|
+
"id": "http://jsonschema.net/id",
|
254
|
+
"required":true
|
255
|
+
},
|
256
|
+
"item_count": {
|
257
|
+
"type":"number",
|
258
|
+
"description": "Number of items in the collection",
|
259
|
+
"id": "http://jsonschema.net/item_count",
|
260
|
+
"required":true
|
261
|
+
},
|
262
|
+
"name": {
|
263
|
+
"type":"string",
|
264
|
+
"id": "http://jsonschema.net/name",
|
265
|
+
"required":false
|
266
|
+
},
|
267
|
+
"readypulse_user": {
|
268
|
+
"type":"object",
|
269
|
+
"id": "http://jsonschema.net/readypulse_user",
|
270
|
+
"required":false,
|
271
|
+
"properties":{
|
272
|
+
"id": {
|
273
|
+
"type":"number",
|
274
|
+
"id": "http://jsonschema.net/readypulse_user/id",
|
275
|
+
"required":false
|
276
|
+
},
|
277
|
+
"name": {
|
278
|
+
"type":"string",
|
279
|
+
"id": "http://jsonschema.net/readypulse_user/name",
|
280
|
+
"required":false
|
281
|
+
}
|
282
|
+
}
|
283
|
+
},
|
284
|
+
"type": {
|
285
|
+
"type":"string",
|
286
|
+
"id": "http://jsonschema.net/type",
|
287
|
+
"required":false
|
288
|
+
},
|
289
|
+
"updated_at": {
|
290
|
+
"type":"string",
|
291
|
+
"id": "http://jsonschema.net/updated_at",
|
292
|
+
"required":false
|
293
|
+
}
|
294
|
+
}
|
295
|
+
}
|
296
|
+
```
|
data/lib/readypulse.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
module Readypulse
|
2
|
+
class Album
|
3
|
+
|
4
|
+
ATTR_FIELDS = %w(created_at description item_count name readypulse_user type
|
5
|
+
updated_at)
|
6
|
+
|
7
|
+
attr_accessor :id, :brand, :content, :description, :item_count, :name,
|
8
|
+
:readypulse_user, :type, :created_at, :updated_at
|
9
|
+
|
10
|
+
def initialize(id:)
|
11
|
+
@id = id
|
12
|
+
ATTR_FIELDS.each do |attr_field|
|
13
|
+
instance_variable_set( "@" + attr_field, get_album[attr_field.to_sym])
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def images
|
18
|
+
@images ||= ImageCollection.new(album_id: id)
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
def get_album
|
23
|
+
from_client
|
24
|
+
end
|
25
|
+
|
26
|
+
def from_client
|
27
|
+
Client.instance.to_album(album_id: id)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
module Readypulse
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
class Client
|
5
|
+
def self.instance
|
6
|
+
@@client ||= Client.new
|
7
|
+
end
|
8
|
+
|
9
|
+
attr_accessor :album_id
|
10
|
+
|
11
|
+
def initialize
|
12
|
+
end
|
13
|
+
|
14
|
+
def to_album(album_id: @album_id)
|
15
|
+
validate_album_id(album_id)
|
16
|
+
parsed_album_response
|
17
|
+
end
|
18
|
+
|
19
|
+
def to_images(album_id: @album_id)
|
20
|
+
validate_album_id(album_id)
|
21
|
+
parsed_response_content
|
22
|
+
# parsed_response_content.first
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def validate_album_id(album_id)
|
28
|
+
unless album_id.is_a?(Fixnum)
|
29
|
+
fail ArgumentError.new("Incorrect album_id value: #{album_id.inspect}")
|
30
|
+
end
|
31
|
+
|
32
|
+
reset_response! if album_id_changed?(album_id)
|
33
|
+
end
|
34
|
+
|
35
|
+
def album_id_changed?(album_id)
|
36
|
+
changed = (@album_id == album_id)
|
37
|
+
@album_id = album_id
|
38
|
+
return changed
|
39
|
+
end
|
40
|
+
|
41
|
+
def reset_response!
|
42
|
+
@response = nil
|
43
|
+
end
|
44
|
+
|
45
|
+
def parsed_album_response
|
46
|
+
parsed_response.tap{|hash| hash.delete(:content)}
|
47
|
+
end
|
48
|
+
|
49
|
+
def parsed_response_content
|
50
|
+
parsed_response[:content]
|
51
|
+
end
|
52
|
+
|
53
|
+
def parsed_response
|
54
|
+
JSON.parse(response,:symbolize_names => true)
|
55
|
+
end
|
56
|
+
|
57
|
+
def response
|
58
|
+
@response || response!
|
59
|
+
end
|
60
|
+
|
61
|
+
def response!
|
62
|
+
@response = Net::HTTP.get(uri)
|
63
|
+
# TODO: What is the right error message here?
|
64
|
+
fail TimeoutError.new if @response.empty? || @response.nil?
|
65
|
+
@response
|
66
|
+
end
|
67
|
+
|
68
|
+
def uri
|
69
|
+
URI("http://widgets.readypulse.com/api/v1/widgets/#{album_id}.json")
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
module Readypulse
|
2
|
+
class Image < Hash
|
3
|
+
|
4
|
+
# # Public: Container for ImageType objects.
|
5
|
+
#
|
6
|
+
# raw_image - raw image information from Readypulse API
|
7
|
+
#
|
8
|
+
# Examples
|
9
|
+
#
|
10
|
+
# image = Image.new(raw_image: {:id=>"4::instagram::instagram_012014",
|
11
|
+
# :uniq_id=>"3542844_630741923525326235_3542844",
|
12
|
+
# :external_network_id=>"630741923525326235_3542844",
|
13
|
+
# :content_source=>"instagram",
|
14
|
+
# :content_index=>"instagram_012014",
|
15
|
+
# :type=>"photo",
|
16
|
+
# :has_media=>true,
|
17
|
+
# :story_url=>"http://instagram.com/p/jA2HAIrHWb/",
|
18
|
+
# :external_conversation_link=>"http://instagram.com/p/jA2HAIrHWb/",
|
19
|
+
# :user_text=>"Smoke em if you got em #kr3wkills",
|
20
|
+
# :timestamp=>"2014-01-11T03:18:38Z",
|
21
|
+
# :social_timestamp=>"January 11, 2014",
|
22
|
+
# :social_attributes=>{:Likes=>1220, :Comments=>7},
|
23
|
+
# :readypulse_content_score=>44.13,
|
24
|
+
# :sentiment=>"neutral",
|
25
|
+
# :is_consented=>false,
|
26
|
+
# :is_incentivized=>false,
|
27
|
+
# :is_compliant=>nil,
|
28
|
+
# :is_approved=>nil,
|
29
|
+
# :cta=>nil,
|
30
|
+
# :media=>{:images=>[{:type=>"email", :url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_150,q_75,w_220/v1418764365/ig_3542844_630741923525326235_3542844.jpg", :width=>220, :height=>150},
|
31
|
+
# {:type=>"tile", :url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_250,q_75,w_300/v1418764365/ig_3542844_630741923525326235_3542844.jpg", :width=>300, :height=>250},
|
32
|
+
# {:type=>"square-tile", :url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_300,q_75,w_300/v1418764365/ig_3542844_630741923525326235_3542844.jpg", :width=>300, :height=>300},
|
33
|
+
# {:type=>"mobile-tile", :url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_250,q_75,w_300/v1418764365/ig_3542844_630741923525326235_3542844.jpg", :width=>300, :height=>250},
|
34
|
+
# {:type=>"large", :url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/b_white,c_pad,fl_progressive,g_center,h_550,q_90,w_550/v1418764365/ig_3542844_630741923525326235_3542844.jpg", :width=>550, :height=>550},
|
35
|
+
# {:type=>"original", :url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/b_white,c_pad,fl_progressive,g_center,q_90/v1418764365/ig_3542844_630741923525326235_3542844.jpg", :width=>640, :height=>640}]},
|
36
|
+
# :actor=>{:social_id=>"3542844",
|
37
|
+
# :handle_name=>"kr3wdenim",
|
38
|
+
# :name=>"KR3W Denim",
|
39
|
+
# :bio=>"#rightsrefused #no11 #rehabdenim #kr3wkills",
|
40
|
+
# :image_url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_50,q_75,w_50/ig_3542844.jpg",
|
41
|
+
# :url=>"http://www.instagram.com/kr3wdenim"},
|
42
|
+
# :products=>[{:id=>"4850_google_store_k5131408",
|
43
|
+
# :catalog_id=>"k5131408",
|
44
|
+
# :name=>"SKELETON KR3W",
|
45
|
+
# :description=>nil, :price=>"28.0",
|
46
|
+
# :url=>"http://kr3wdenim.com/products/k5131408",
|
47
|
+
# :image=>"https://s7d9.scene7.com/is/image/onedist/SKELETONKR3W_K5131408_BLK_Back?$ecomm_detail_main$",
|
48
|
+
# :thumbnail_image_url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_pad,h_200,w_200/wn2eye3ztervwcuhqbzr.jpg",
|
49
|
+
# :tiny_image_url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_pad,h_50,w_50/wn2eye3ztervwcuhqbzr.jpg"}]
|
50
|
+
# }
|
51
|
+
#
|
52
|
+
#
|
53
|
+
# image['email'] => #<ImageType @type="email" @url="http://example.com/4.jpg">
|
54
|
+
#
|
55
|
+
# returns an Image object with ImageType objects at the root too
|
56
|
+
|
57
|
+
attr_accessor :readypulse_content_score
|
58
|
+
|
59
|
+
def initialize(raw_image:)
|
60
|
+
@readypulse_content_score = raw_image[:readypulse_content_score]
|
61
|
+
|
62
|
+
|
63
|
+
raw_image.fetch(:media, {}).fetch(:images, []).each do |raw_type|
|
64
|
+
self.store(raw_type[:type], ImageType.new(raw_type: raw_type))
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def types
|
69
|
+
self.keys
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Readypulse
|
2
|
+
class ImageCollection
|
3
|
+
|
4
|
+
include Enumerable
|
5
|
+
attr_accessor :images, :album_id
|
6
|
+
|
7
|
+
def initialize(album_id:)
|
8
|
+
@album_id = album_id
|
9
|
+
end
|
10
|
+
|
11
|
+
def each(&block)
|
12
|
+
images.each(&block)
|
13
|
+
end
|
14
|
+
|
15
|
+
def all
|
16
|
+
images
|
17
|
+
end
|
18
|
+
|
19
|
+
def images
|
20
|
+
@images ||= get_images
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def get_images
|
26
|
+
from_client.map do |raw_image|
|
27
|
+
Image.new(raw_image: raw_image)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def from_client
|
32
|
+
Client.instance.to_images(album_id: album_id)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Readypulse
|
2
|
+
class ImageType
|
3
|
+
|
4
|
+
attr_accessor :type, :url, :width, :height
|
5
|
+
def initialize(raw_type:)
|
6
|
+
%w(type url width height).each do |attribute|
|
7
|
+
instance_variable_set( "@" + attribute, raw_type.fetch(attribute.to_sym))
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
data/readypulse.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'readypulse/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'readypulse'
|
8
|
+
spec.version = Readypulse::VERSION
|
9
|
+
spec.authors = ['Chad Metcalf']
|
10
|
+
spec.email = ['cmetcalf@nerdery.com']
|
11
|
+
spec.summary = %q{Readypulse API wrapper.}
|
12
|
+
spec.description = %q{Readypulse API wrapper.}
|
13
|
+
spec.homepage = ''
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_development_dependency 'bundler', '~> 1.7'
|
22
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
23
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
24
|
+
spec.add_development_dependency 'rspec-its'
|
25
|
+
spec.add_development_dependency 'rspec-collection_matchers'
|
26
|
+
spec.add_development_dependency 'guard-rspec'
|
27
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Readypulse
|
2
|
+
RSpec.describe Album do
|
3
|
+
let(:album_id) {1}
|
4
|
+
subject(:album) {Album.new(id: album_id)}
|
5
|
+
|
6
|
+
before(:each) do
|
7
|
+
client = double(Client)
|
8
|
+
allow(Client).to receive(:instance).and_return(client)
|
9
|
+
allow(client).to receive(:to_album).and_return(from_client)
|
10
|
+
end
|
11
|
+
|
12
|
+
context '.new' do
|
13
|
+
it 'requires an id value' do
|
14
|
+
no_id_album = ->{Album.new}
|
15
|
+
|
16
|
+
expect{no_id_album.call}.to raise_error
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'is successful' do
|
20
|
+
expect(album).to be_an(Album)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
its(:id) { is_expected.to eq(from_client[:id]) }
|
25
|
+
its(:description) { is_expected.to eq(from_client[:description]) }
|
26
|
+
its(:item_count) { is_expected.to eq(from_client[:item_count]) }
|
27
|
+
its(:name) { is_expected.to eq(from_client[:name]) }
|
28
|
+
its(:type) { is_expected.to eq(from_client[:type]) }
|
29
|
+
its(:readypulse_user) { is_expected.to eq(from_client[:readypulse_user]) }
|
30
|
+
its(:created_at) { is_expected.to eq(from_client[:created_at]) }
|
31
|
+
its(:updated_at) { is_expected.to eq(from_client[:updated_at]) }
|
32
|
+
|
33
|
+
it '#images' do
|
34
|
+
allow(ImageCollection).to receive(:new).with(album_id: album_id)
|
35
|
+
album.images
|
36
|
+
expect(ImageCollection).to have_received(:new)
|
37
|
+
end
|
38
|
+
|
39
|
+
def from_client
|
40
|
+
{:id=>1, :name=>"My Very First Curation", :description=>"This is my first curation on the ReadyPulse production site.", :type=>"static", :created_at=>"2012-04-09T09:35:07Z", :updated_at=>"2015-01-21T17:10:57Z", :brand=>{:id=>162, :name=>"Metal Mulisha"}, :readypulse_user=>{:id=>1, :name=>"Mihir Vaidya"}, :item_count=>3}
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module Readypulse
|
2
|
+
RSpec.describe Client do
|
3
|
+
subject(:client) {Client.instance}
|
4
|
+
let(:album_id) {1}
|
5
|
+
|
6
|
+
before(:each) do
|
7
|
+
allow(Net::HTTP).to receive(:get).
|
8
|
+
with(URI("http://widgets.readypulse.com/api/v1/widgets/#{album_id}.json")).
|
9
|
+
and_return(readypulse_response)
|
10
|
+
end
|
11
|
+
|
12
|
+
it '.instance is a singleton' do
|
13
|
+
additional_client = Client.instance
|
14
|
+
|
15
|
+
expect(additional_client).to be(client)
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'when album_id changes, a new request is made' do
|
19
|
+
skip("This feature is low priority, come back around if you get a chance")
|
20
|
+
expect(client).to receive(:response!).twice
|
21
|
+
client.to_album(album_id: album_id)
|
22
|
+
client.to_album(album_id: album_id)
|
23
|
+
end
|
24
|
+
|
25
|
+
it '#to_album' do
|
26
|
+
expect(client.to_album(album_id: album_id)).to eq(from_client_to_album)
|
27
|
+
end
|
28
|
+
|
29
|
+
it '#to_images' do
|
30
|
+
expect(client.to_images(album_id: album_id)).to eq(from_client_to_image)
|
31
|
+
end
|
32
|
+
|
33
|
+
def from_client_to_album
|
34
|
+
{:id=>1, :name=>"My Very First Curation", :description=>"This is my first curation on the ReadyPulse production site.", :type=>"static", :created_at=>"2012-04-09T09:35:07Z", :updated_at=>"2015-01-21T17:10:57Z", :brand=>{:id=>162, :name=>"Metal Mulisha"}, :readypulse_user=>{:id=>1, :name=>"Mihir Vaidya"}, :item_count=>3}
|
35
|
+
end
|
36
|
+
|
37
|
+
def from_client_to_image
|
38
|
+
[{:id=>"3542844_630741923525326235_3542844::instagram::instagram_012014", :uniq_id=>"3542844_630741923525326235_3542844", :external_network_id=>"630741923525326235_3542844", :content_source=>"instagram", :content_index=>"instagram_012014", :type=>"photo", :has_media=>true, :story_url=>"http://instagram.com/p/jA2HAIrHWb/", :external_conversation_link=>"http://instagram.com/p/jA2HAIrHWb/", :user_text=>"Smoke em if you got em #kr3wkills", :timestamp=>"2014-01-11T03:18:38Z", :social_timestamp=>"January 11, 2014", :social_attributes=>{:Likes=>1220, :Comments=>7}, :readypulse_content_score=>44.13, :sentiment=>"neutral", :is_consented=>false, :is_incentivized=>false, :is_compliant=>nil, :is_approved=>nil, :cta=>nil, :media=>{:images=>[{:type=>"email", :url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_150,q_75,w_220/v1418764365/ig_3542844_630741923525326235_3542844.jpg", :width=>220, :height=>150}, {:type=>"tile", :url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_250,q_75,w_300/v1418764365/ig_3542844_630741923525326235_3542844.jpg", :width=>300, :height=>250}, {:type=>"square-tile", :url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_300,q_75,w_300/v1418764365/ig_3542844_630741923525326235_3542844.jpg", :width=>300, :height=>300}, {:type=>"mobile-tile", :url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_250,q_75,w_300/v1418764365/ig_3542844_630741923525326235_3542844.jpg", :width=>300, :height=>250}, {:type=>"large", :url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/b_white,c_pad,fl_progressive,g_center,h_550,q_90,w_550/v1418764365/ig_3542844_630741923525326235_3542844.jpg", :width=>550, :height=>550}, {:type=>"original", :url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/b_white,c_pad,fl_progressive,g_center,q_90/v1418764365/ig_3542844_630741923525326235_3542844.jpg", :width=>640, :height=>640}]}, :actor=>{:social_id=>"3542844", :handle_name=>"kr3wdenim", :name=>"KR3W Denim", :bio=>"#rightsrefused #no11 #rehabdenim #kr3wkills", :image_url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_50,q_75,w_50/ig_3542844.jpg", :url=>"http://www.instagram.com/kr3wdenim"}, :products=>[{:id=>"4850_google_store_k5131408", :catalog_id=>"k5131408", :name=>"SKELETON KR3W", :description=>nil, :price=>"28.0", :url=>"http://kr3wdenim.com/products/k5131408", :image=>"https://s7d9.scene7.com/is/image/onedist/SKELETONKR3W_K5131408_BLK_Back?$ecomm_detail_main$", :thumbnail_image_url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_pad,h_200,w_200/wn2eye3ztervwcuhqbzr.jpg", :tiny_image_url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_pad,h_50,w_50/wn2eye3ztervwcuhqbzr.jpg"}]}, {:id=>"reebokoneseries_636365886051018888_840944057::instagram::instagram_012014", :uniq_id=>"reebokoneseries_636365886051018888_840944057", :external_network_id=>"636365886051018888_840944057", :content_source=>"instagram", :content_index=>"instagram_012014", :type=>"photo", :has_media=>true, :story_url=>"https://instagram.com/p/jU02bZP2iI/", :external_conversation_link=>"https://instagram.com/p/jU02bZP2iI/", :user_text=>"We did shine! \n#ReebokOneSeries #lightedlaces #Vondelpark #running", :timestamp=>"2014-01-18T21:32:26Z", :social_timestamp=>"January 18, 2014", :social_attributes=>{:Likes=>7}, :readypulse_content_score=>53.23, :sentiment=>"positive", :is_consented=>false, :is_incentivized=>false, :is_compliant=>nil, :is_approved=>true, :cta=>nil, :media=>{:images=>[{:type=>"email", :url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_150,q_75,w_220/v1401839306/ig_reebokoneseries_636365886051018888_840944057.jpg", :width=>220, :height=>150}, {:type=>"tile", :url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_250,q_75,w_300/v1401839306/ig_reebokoneseries_636365886051018888_840944057.jpg", :width=>300, :height=>250}, {:type=>"square-tile", :url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_300,q_75,w_300/v1401839306/ig_reebokoneseries_636365886051018888_840944057.jpg", :width=>300, :height=>300}, {:type=>"mobile-tile", :url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_250,q_75,w_300/v1401839306/ig_reebokoneseries_636365886051018888_840944057.jpg", :width=>300, :height=>250}, {:type=>"large", :url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/b_white,c_pad,fl_progressive,g_center,h_550,q_90,w_550/v1401839306/ig_reebokoneseries_636365886051018888_840944057.jpg", :width=>550, :height=>550}, {:type=>"original", :url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/b_white,c_pad,fl_progressive,g_center,q_90/v1401839306/ig_reebokoneseries_636365886051018888_840944057.jpg", :width=>640, :height=>640}]}, :actor=>{:social_id=>"840944057", :handle_name=>"jessyhoutman", :name=>"Jessy", :bio=>"Marketing Manager adidas Group Benelux Amsterdam", :image_url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_50,q_75,w_50/ig_840944057.jpg", :url=>"http://www.instagram.com/jessyhoutman"}}, {:id=>"bestfootforward13_605863231064875273_4806511::instagram::instagram_122013", :uniq_id=>"bestfootforward13_605863231064875273_4806511", :external_network_id=>"605863231064875273_4806511", :content_source=>"instagram", :content_index=>"instagram_122013", :type=>"photo", :has_media=>true, :story_url=>"http://instagram.com/p/hodWYOF6EJ/", :external_conversation_link=>"http://instagram.com/p/hodWYOF6EJ/", :user_text=>"#bestfootforward13 Houston winner Ryan Thompson today at #tampaam @spottampa", :timestamp=>"2013-12-07T19:30:06Z", :social_timestamp=>"December 07, 2013", :social_attributes=>{:Likes=>4307, :Comments=>9}, :readypulse_content_score=>37.98, :sentiment=>"neutral", :is_consented=>false, :is_incentivized=>false, :is_compliant=>nil, :is_approved=>true, :cta=>nil, :media=>{:images=>[{:type=>"email", :url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_150,q_75,w_220/v1390954685/ig_bestfootforward13_605863231064875273_4806511.jpg", :width=>220, :height=>150}, {:type=>"tile", :url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_250,q_75,w_300/v1390954685/ig_bestfootforward13_605863231064875273_4806511.jpg", :width=>300, :height=>250}, {:type=>"square-tile", :url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_300,q_75,w_300/v1390954685/ig_bestfootforward13_605863231064875273_4806511.jpg", :width=>300, :height=>300}, {:type=>"mobile-tile", :url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_250,q_75,w_300/v1390954685/ig_bestfootforward13_605863231064875273_4806511.jpg", :width=>300, :height=>250}, {:type=>"large", :url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/b_white,c_pad,fl_progressive,g_center,h_550,q_90,w_550/v1390954685/ig_bestfootforward13_605863231064875273_4806511.jpg", :width=>550, :height=>550}, {:type=>"original", :url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/b_white,c_pad,fl_progressive,g_center,q_90/v1390954685/ig_bestfootforward13_605863231064875273_4806511.jpg", :width=>640, :height=>640}]}, :actor=>{:social_id=>"4806511", :handle_name=>"zumiez", :name=>"zumiez", :bio=>"Since 1978 Zumiez has been a leading retailer of action sports clothing, and accessories providing a unique selection of brands in each of our stores", :image_url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_50,q_75,w_50/ig_4806511.jpg", :url=>"http://www.instagram.com/zumiez"}}]
|
39
|
+
end
|
40
|
+
|
41
|
+
def readypulse_response
|
42
|
+
"{\"id\":1,\"name\":\"My Very First Curation\",\"description\":\"This is my first curation on the ReadyPulse production site.\",\"type\":\"static\",\"created_at\":\"2012-04-09T09:35:07Z\",\"updated_at\":\"2015-01-21T17:10:57Z\",\"brand\":{\"id\":162,\"name\":\"Metal Mulisha\"},\"readypulse_user\":{\"id\":1,\"name\":\"Mihir Vaidya\"},\"item_count\":3,\"content\":[{\"id\":\"3542844_630741923525326235_3542844::instagram::instagram_012014\",\"uniq_id\":\"3542844_630741923525326235_3542844\",\"external_network_id\":\"630741923525326235_3542844\",\"content_source\":\"instagram\",\"content_index\":\"instagram_012014\",\"type\":\"photo\",\"has_media\":true,\"story_url\":\"http://instagram.com/p/jA2HAIrHWb/\",\"external_conversation_link\":\"http://instagram.com/p/jA2HAIrHWb/\",\"user_text\":\"Smoke em if you got em #kr3wkills\",\"timestamp\":\"2014-01-11T03:18:38Z\",\"social_timestamp\":\"January 11, 2014\",\"social_attributes\":{\"Likes\":1220,\"Comments\":7},\"readypulse_content_score\":44.13,\"sentiment\":\"neutral\",\"is_consented\":false,\"is_incentivized\":false,\"is_compliant\":null,\"is_approved\":null,\"cta\":null,\"media\":{\"images\":[{\"type\":\"email\",\"url\":\"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_150,q_75,w_220/v1418764365/ig_3542844_630741923525326235_3542844.jpg\",\"width\":220,\"height\":150},{\"type\":\"tile\",\"url\":\"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_250,q_75,w_300/v1418764365/ig_3542844_630741923525326235_3542844.jpg\",\"width\":300,\"height\":250},{\"type\":\"square-tile\",\"url\":\"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_300,q_75,w_300/v1418764365/ig_3542844_630741923525326235_3542844.jpg\",\"width\":300,\"height\":300},{\"type\":\"mobile-tile\",\"url\":\"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_250,q_75,w_300/v1418764365/ig_3542844_630741923525326235_3542844.jpg\",\"width\":300,\"height\":250},{\"type\":\"large\",\"url\":\"https://cloudinary-a.akamaihd.net/readypulse/image/upload/b_white,c_pad,fl_progressive,g_center,h_550,q_90,w_550/v1418764365/ig_3542844_630741923525326235_3542844.jpg\",\"width\":550,\"height\":550},{\"type\":\"original\",\"url\":\"https://cloudinary-a.akamaihd.net/readypulse/image/upload/b_white,c_pad,fl_progressive,g_center,q_90/v1418764365/ig_3542844_630741923525326235_3542844.jpg\",\"width\":640,\"height\":640}]},\"actor\":{\"social_id\":\"3542844\",\"handle_name\":\"kr3wdenim\",\"name\":\"KR3W Denim\",\"bio\":\"#rightsrefused #no11 #rehabdenim #kr3wkills\",\"image_url\":\"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_50,q_75,w_50/ig_3542844.jpg\",\"url\":\"http://www.instagram.com/kr3wdenim\"},\"products\":[{\"id\":\"4850_google_store_k5131408\",\"catalog_id\":\"k5131408\",\"name\":\"SKELETON KR3W\",\"description\":null,\"price\":\"28.0\",\"url\":\"http://kr3wdenim.com/products/k5131408\",\"image\":\"https://s7d9.scene7.com/is/image/onedist/SKELETONKR3W_K5131408_BLK_Back?$ecomm_detail_main$\",\"thumbnail_image_url\":\"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_pad,h_200,w_200/wn2eye3ztervwcuhqbzr.jpg\",\"tiny_image_url\":\"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_pad,h_50,w_50/wn2eye3ztervwcuhqbzr.jpg\"}]},{\"id\":\"reebokoneseries_636365886051018888_840944057::instagram::instagram_012014\",\"uniq_id\":\"reebokoneseries_636365886051018888_840944057\",\"external_network_id\":\"636365886051018888_840944057\",\"content_source\":\"instagram\",\"content_index\":\"instagram_012014\",\"type\":\"photo\",\"has_media\":true,\"story_url\":\"https://instagram.com/p/jU02bZP2iI/\",\"external_conversation_link\":\"https://instagram.com/p/jU02bZP2iI/\",\"user_text\":\"We did shine! \\n#ReebokOneSeries #lightedlaces #Vondelpark #running\",\"timestamp\":\"2014-01-18T21:32:26Z\",\"social_timestamp\":\"January 18, 2014\",\"social_attributes\":{\"Likes\":7},\"readypulse_content_score\":53.23,\"sentiment\":\"positive\",\"is_consented\":false,\"is_incentivized\":false,\"is_compliant\":null,\"is_approved\":true,\"cta\":null,\"media\":{\"images\":[{\"type\":\"email\",\"url\":\"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_150,q_75,w_220/v1401839306/ig_reebokoneseries_636365886051018888_840944057.jpg\",\"width\":220,\"height\":150},{\"type\":\"tile\",\"url\":\"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_250,q_75,w_300/v1401839306/ig_reebokoneseries_636365886051018888_840944057.jpg\",\"width\":300,\"height\":250},{\"type\":\"square-tile\",\"url\":\"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_300,q_75,w_300/v1401839306/ig_reebokoneseries_636365886051018888_840944057.jpg\",\"width\":300,\"height\":300},{\"type\":\"mobile-tile\",\"url\":\"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_250,q_75,w_300/v1401839306/ig_reebokoneseries_636365886051018888_840944057.jpg\",\"width\":300,\"height\":250},{\"type\":\"large\",\"url\":\"https://cloudinary-a.akamaihd.net/readypulse/image/upload/b_white,c_pad,fl_progressive,g_center,h_550,q_90,w_550/v1401839306/ig_reebokoneseries_636365886051018888_840944057.jpg\",\"width\":550,\"height\":550},{\"type\":\"original\",\"url\":\"https://cloudinary-a.akamaihd.net/readypulse/image/upload/b_white,c_pad,fl_progressive,g_center,q_90/v1401839306/ig_reebokoneseries_636365886051018888_840944057.jpg\",\"width\":640,\"height\":640}]},\"actor\":{\"social_id\":\"840944057\",\"handle_name\":\"jessyhoutman\",\"name\":\"Jessy\",\"bio\":\"Marketing Manager adidas Group Benelux Amsterdam\",\"image_url\":\"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_50,q_75,w_50/ig_840944057.jpg\",\"url\":\"http://www.instagram.com/jessyhoutman\"}},{\"id\":\"bestfootforward13_605863231064875273_4806511::instagram::instagram_122013\",\"uniq_id\":\"bestfootforward13_605863231064875273_4806511\",\"external_network_id\":\"605863231064875273_4806511\",\"content_source\":\"instagram\",\"content_index\":\"instagram_122013\",\"type\":\"photo\",\"has_media\":true,\"story_url\":\"http://instagram.com/p/hodWYOF6EJ/\",\"external_conversation_link\":\"http://instagram.com/p/hodWYOF6EJ/\",\"user_text\":\"#bestfootforward13 Houston winner Ryan Thompson today at #tampaam @spottampa\",\"timestamp\":\"2013-12-07T19:30:06Z\",\"social_timestamp\":\"December 07, 2013\",\"social_attributes\":{\"Likes\":4307,\"Comments\":9},\"readypulse_content_score\":37.98,\"sentiment\":\"neutral\",\"is_consented\":false,\"is_incentivized\":false,\"is_compliant\":null,\"is_approved\":true,\"cta\":null,\"media\":{\"images\":[{\"type\":\"email\",\"url\":\"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_150,q_75,w_220/v1390954685/ig_bestfootforward13_605863231064875273_4806511.jpg\",\"width\":220,\"height\":150},{\"type\":\"tile\",\"url\":\"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_250,q_75,w_300/v1390954685/ig_bestfootforward13_605863231064875273_4806511.jpg\",\"width\":300,\"height\":250},{\"type\":\"square-tile\",\"url\":\"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_300,q_75,w_300/v1390954685/ig_bestfootforward13_605863231064875273_4806511.jpg\",\"width\":300,\"height\":300},{\"type\":\"mobile-tile\",\"url\":\"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_250,q_75,w_300/v1390954685/ig_bestfootforward13_605863231064875273_4806511.jpg\",\"width\":300,\"height\":250},{\"type\":\"large\",\"url\":\"https://cloudinary-a.akamaihd.net/readypulse/image/upload/b_white,c_pad,fl_progressive,g_center,h_550,q_90,w_550/v1390954685/ig_bestfootforward13_605863231064875273_4806511.jpg\",\"width\":550,\"height\":550},{\"type\":\"original\",\"url\":\"https://cloudinary-a.akamaihd.net/readypulse/image/upload/b_white,c_pad,fl_progressive,g_center,q_90/v1390954685/ig_bestfootforward13_605863231064875273_4806511.jpg\",\"width\":640,\"height\":640}]},\"actor\":{\"social_id\":\"4806511\",\"handle_name\":\"zumiez\",\"name\":\"zumiez\",\"bio\":\"Since 1978 Zumiez has been a leading retailer of action sports clothing, and accessories providing a unique selection of brands in each of our stores\",\"image_url\":\"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_50,q_75,w_50/ig_4806511.jpg\",\"url\":\"http://www.instagram.com/zumiez\"}}]}"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Readypulse
|
2
|
+
RSpec.describe ImageCollection do
|
3
|
+
let(:album_id) {1}
|
4
|
+
subject(:image_collection) {ImageCollection.new(album_id: album_id)}
|
5
|
+
|
6
|
+
before(:each) do
|
7
|
+
client = double(Client)
|
8
|
+
allow(Client).to receive(:instance).and_return(client)
|
9
|
+
allow(client).to receive(:to_images).and_return(from_client)
|
10
|
+
|
11
|
+
image = double(Image)
|
12
|
+
allow(Image).to receive(:new).and_return(image)
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'has image_type objects' do
|
16
|
+
expect(image_collection).to have(3).images
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
def from_client
|
21
|
+
[{:id=>"3542844_630741923525326235_3542844::instagram::instagram_012014", :uniq_id=>"3542844_630741923525326235_3542844", :external_network_id=>"630741923525326235_3542844", :content_source=>"instagram", :content_index=>"instagram_012014", :type=>"photo", :has_media=>true, :story_url=>"http://instagram.com/p/jA2HAIrHWb/", :external_conversation_link=>"http://instagram.com/p/jA2HAIrHWb/", :user_text=>"Smoke em if you got em #kr3wkills", :timestamp=>"2014-01-11T03:18:38Z", :social_timestamp=>"January 11, 2014", :social_attributes=>{:Likes=>1220, :Comments=>7}, :readypulse_content_score=>44.13, :sentiment=>"neutral", :is_consented=>false, :is_incentivized=>false, :is_compliant=>nil, :is_approved=>nil, :cta=>nil, :media=>{:images=>[{:type=>"email", :url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_150,q_75,w_220/v1418764365/ig_3542844_630741923525326235_3542844.jpg", :width=>220, :height=>150}, {:type=>"tile", :url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_250,q_75,w_300/v1418764365/ig_3542844_630741923525326235_3542844.jpg", :width=>300, :height=>250}, {:type=>"square-tile", :url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_300,q_75,w_300/v1418764365/ig_3542844_630741923525326235_3542844.jpg", :width=>300, :height=>300}, {:type=>"mobile-tile", :url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_250,q_75,w_300/v1418764365/ig_3542844_630741923525326235_3542844.jpg", :width=>300, :height=>250}, {:type=>"large", :url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/b_white,c_pad,fl_progressive,g_center,h_550,q_90,w_550/v1418764365/ig_3542844_630741923525326235_3542844.jpg", :width=>550, :height=>550}, {:type=>"original", :url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/b_white,c_pad,fl_progressive,g_center,q_90/v1418764365/ig_3542844_630741923525326235_3542844.jpg", :width=>640, :height=>640}]}, :actor=>{:social_id=>"3542844", :handle_name=>"kr3wdenim", :name=>"KR3W Denim", :bio=>"#rightsrefused #no11 #rehabdenim #kr3wkills", :image_url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_50,q_75,w_50/ig_3542844.jpg", :url=>"http://www.instagram.com/kr3wdenim"}, :products=>[{:id=>"4850_google_store_k5131408", :catalog_id=>"k5131408", :name=>"SKELETON KR3W", :description=>nil, :price=>"28.0", :url=>"http://kr3wdenim.com/products/k5131408", :image=>"https://s7d9.scene7.com/is/image/onedist/SKELETONKR3W_K5131408_BLK_Back?$ecomm_detail_main$", :thumbnail_image_url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_pad,h_200,w_200/wn2eye3ztervwcuhqbzr.jpg", :tiny_image_url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_pad,h_50,w_50/wn2eye3ztervwcuhqbzr.jpg"}]}, {:id=>"reebokoneseries_636365886051018888_840944057::instagram::instagram_012014", :uniq_id=>"reebokoneseries_636365886051018888_840944057", :external_network_id=>"636365886051018888_840944057", :content_source=>"instagram", :content_index=>"instagram_012014", :type=>"photo", :has_media=>true, :story_url=>"https://instagram.com/p/jU02bZP2iI/", :external_conversation_link=>"https://instagram.com/p/jU02bZP2iI/", :user_text=>"We did shine! \n#ReebokOneSeries #lightedlaces #Vondelpark #running", :timestamp=>"2014-01-18T21:32:26Z", :social_timestamp=>"January 18, 2014", :social_attributes=>{:Likes=>7}, :readypulse_content_score=>53.23, :sentiment=>"positive", :is_consented=>false, :is_incentivized=>false, :is_compliant=>nil, :is_approved=>true, :cta=>nil, :media=>{:images=>[{:type=>"email", :url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_150,q_75,w_220/v1401839306/ig_reebokoneseries_636365886051018888_840944057.jpg", :width=>220, :height=>150}, {:type=>"tile", :url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_250,q_75,w_300/v1401839306/ig_reebokoneseries_636365886051018888_840944057.jpg", :width=>300, :height=>250}, {:type=>"square-tile", :url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_300,q_75,w_300/v1401839306/ig_reebokoneseries_636365886051018888_840944057.jpg", :width=>300, :height=>300}, {:type=>"mobile-tile", :url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_250,q_75,w_300/v1401839306/ig_reebokoneseries_636365886051018888_840944057.jpg", :width=>300, :height=>250}, {:type=>"large", :url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/b_white,c_pad,fl_progressive,g_center,h_550,q_90,w_550/v1401839306/ig_reebokoneseries_636365886051018888_840944057.jpg", :width=>550, :height=>550}, {:type=>"original", :url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/b_white,c_pad,fl_progressive,g_center,q_90/v1401839306/ig_reebokoneseries_636365886051018888_840944057.jpg", :width=>640, :height=>640}]}, :actor=>{:social_id=>"840944057", :handle_name=>"jessyhoutman", :name=>"Jessy", :bio=>"Marketing Manager adidas Group Benelux Amsterdam", :image_url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_50,q_75,w_50/ig_840944057.jpg", :url=>"http://www.instagram.com/jessyhoutman"}}, {:id=>"bestfootforward13_605863231064875273_4806511::instagram::instagram_122013", :uniq_id=>"bestfootforward13_605863231064875273_4806511", :external_network_id=>"605863231064875273_4806511", :content_source=>"instagram", :content_index=>"instagram_122013", :type=>"photo", :has_media=>true, :story_url=>"http://instagram.com/p/hodWYOF6EJ/", :external_conversation_link=>"http://instagram.com/p/hodWYOF6EJ/", :user_text=>"#bestfootforward13 Houston winner Ryan Thompson today at #tampaam @spottampa", :timestamp=>"2013-12-07T19:30:06Z", :social_timestamp=>"December 07, 2013", :social_attributes=>{:Likes=>4307, :Comments=>9}, :readypulse_content_score=>37.98, :sentiment=>"neutral", :is_consented=>false, :is_incentivized=>false, :is_compliant=>nil, :is_approved=>true, :cta=>nil, :media=>{:images=>[{:type=>"email", :url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_150,q_75,w_220/v1390954685/ig_bestfootforward13_605863231064875273_4806511.jpg", :width=>220, :height=>150}, {:type=>"tile", :url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_250,q_75,w_300/v1390954685/ig_bestfootforward13_605863231064875273_4806511.jpg", :width=>300, :height=>250}, {:type=>"square-tile", :url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_300,q_75,w_300/v1390954685/ig_bestfootforward13_605863231064875273_4806511.jpg", :width=>300, :height=>300}, {:type=>"mobile-tile", :url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_250,q_75,w_300/v1390954685/ig_bestfootforward13_605863231064875273_4806511.jpg", :width=>300, :height=>250}, {:type=>"large", :url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/b_white,c_pad,fl_progressive,g_center,h_550,q_90,w_550/v1390954685/ig_bestfootforward13_605863231064875273_4806511.jpg", :width=>550, :height=>550}, {:type=>"original", :url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/b_white,c_pad,fl_progressive,g_center,q_90/v1390954685/ig_bestfootforward13_605863231064875273_4806511.jpg", :width=>640, :height=>640}]}, :actor=>{:social_id=>"4806511", :handle_name=>"zumiez", :name=>"zumiez", :bio=>"Since 1978 Zumiez has been a leading retailer of action sports clothing, and accessories providing a unique selection of brands in each of our stores", :image_url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_50,q_75,w_50/ig_4806511.jpg", :url=>"http://www.instagram.com/zumiez"}}]
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Readypulse
|
2
|
+
RSpec.describe Image do
|
3
|
+
subject(:image) {Image.new(raw_image: from_client)}
|
4
|
+
|
5
|
+
its(:types) {is_expected.to eq(["email", "tile", "square-tile", "mobile-tile", "large", "original"])}
|
6
|
+
its(:readypulse_content_score) {is_expected.to eq(from_client[:readypulse_content_score])}
|
7
|
+
|
8
|
+
it 'has image_type objects' do
|
9
|
+
expect(image["email"]).to be_an(ImageType)
|
10
|
+
expect(image["tile"]).to be_an(ImageType)
|
11
|
+
expect(image["square-tile"]).to be_an(ImageType)
|
12
|
+
expect(image["mobile-tile"]).to be_an(ImageType)
|
13
|
+
expect(image["large"]).to be_an(ImageType)
|
14
|
+
expect(image["original"]).to be_an(ImageType)
|
15
|
+
end
|
16
|
+
|
17
|
+
def from_client
|
18
|
+
{:id=>"3542844_630741923525326235_3542844::instagram::instagram_012014", :uniq_id=>"3542844_630741923525326235_3542844", :external_network_id=>"630741923525326235_3542844", :content_source=>"instagram", :content_index=>"instagram_012014", :type=>"photo", :has_media=>true, :story_url=>"http://instagram.com/p/jA2HAIrHWb/", :external_conversation_link=>"http://instagram.com/p/jA2HAIrHWb/", :user_text=>"Smoke em if you got em #kr3wkills", :timestamp=>"2014-01-11T03:18:38Z", :social_timestamp=>"January 11, 2014", :social_attributes=>{:Likes=>1220, :Comments=>7}, :readypulse_content_score=>44.13, :sentiment=>"neutral", :is_consented=>false, :is_incentivized=>false, :is_compliant=>nil, :is_approved=>nil, :cta=>nil, :media=>{:images=>[{:type=>"email", :url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_150,q_75,w_220/v1418764365/ig_3542844_630741923525326235_3542844.jpg", :width=>220, :height=>150}, {:type=>"tile", :url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_250,q_75,w_300/v1418764365/ig_3542844_630741923525326235_3542844.jpg", :width=>300, :height=>250}, {:type=>"square-tile", :url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_300,q_75,w_300/v1418764365/ig_3542844_630741923525326235_3542844.jpg", :width=>300, :height=>300}, {:type=>"mobile-tile", :url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_250,q_75,w_300/v1418764365/ig_3542844_630741923525326235_3542844.jpg", :width=>300, :height=>250}, {:type=>"large", :url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/b_white,c_pad,fl_progressive,g_center,h_550,q_90,w_550/v1418764365/ig_3542844_630741923525326235_3542844.jpg", :width=>550, :height=>550}, {:type=>"original", :url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/b_white,c_pad,fl_progressive,g_center,q_90/v1418764365/ig_3542844_630741923525326235_3542844.jpg", :width=>640, :height=>640}]}, :actor=>{:social_id=>"3542844", :handle_name=>"kr3wdenim", :name=>"KR3W Denim", :bio=>"#rightsrefused #no11 #rehabdenim #kr3wkills", :image_url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_50,q_75,w_50/ig_3542844.jpg", :url=>"http://www.instagram.com/kr3wdenim"}, :products=>[{:id=>"4850_google_store_k5131408", :catalog_id=>"k5131408", :name=>"SKELETON KR3W", :description=>nil, :price=>"28.0", :url=>"http://kr3wdenim.com/products/k5131408", :image=>"https://s7d9.scene7.com/is/image/onedist/SKELETONKR3W_K5131408_BLK_Back?$ecomm_detail_main$", :thumbnail_image_url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_pad,h_200,w_200/wn2eye3ztervwcuhqbzr.jpg", :tiny_image_url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_pad,h_50,w_50/wn2eye3ztervwcuhqbzr.jpg"}]}
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Readypulse
|
2
|
+
RSpec.describe ImageType do
|
3
|
+
subject(:image_type) {ImageType.new(raw_type: from_client)}
|
4
|
+
|
5
|
+
its(:type) { is_expected.to eq(from_client[:type]) }
|
6
|
+
its(:url) { is_expected.to eq(from_client[:url]) }
|
7
|
+
its(:width) { is_expected.to eq(from_client[:width]) }
|
8
|
+
its(:height) { is_expected.to eq(from_client[:height]) }
|
9
|
+
|
10
|
+
|
11
|
+
def from_client
|
12
|
+
{:type=>"email", :url=>"https://cloudinary-a.akamaihd.net/readypulse/image/upload/c_fill,fl_progressive,h_150,q_75,w_220/v1418764365/ig_3542844_630741923525326235_3542844.jpg", :width=>220, :height=>150}
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
|
2
|
+
require 'readypulse'
|
3
|
+
require 'rspec/its'
|
4
|
+
require 'rspec/collection_matchers'
|
5
|
+
|
6
|
+
|
7
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
8
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
9
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
10
|
+
# this file to always be loaded, without a need to explicitly require it in any
|
11
|
+
# files.
|
12
|
+
#
|
13
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
14
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
15
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
16
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
17
|
+
# a separate helper file that requires the additional dependencies and performs
|
18
|
+
# the additional setup, and require it from the spec files that actually need
|
19
|
+
# it.
|
20
|
+
#
|
21
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
22
|
+
# users commonly want.
|
23
|
+
#
|
24
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
25
|
+
RSpec.configure do |config|
|
26
|
+
# rspec-expectations config goes here. You can use an alternate
|
27
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
28
|
+
# assertions if you prefer.
|
29
|
+
config.expect_with :rspec do |expectations|
|
30
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
31
|
+
# and `failure_message` of custom matchers include text for helper methods
|
32
|
+
# defined using `chain`, e.g.:
|
33
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
34
|
+
# # => "be bigger than 2 and smaller than 4"
|
35
|
+
# ...rather than:
|
36
|
+
# # => "be bigger than 2"
|
37
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
38
|
+
end
|
39
|
+
|
40
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
41
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
42
|
+
config.mock_with :rspec do |mocks|
|
43
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
44
|
+
# a real object. This is generally recommended, and will default to
|
45
|
+
# `true` in RSpec 4.
|
46
|
+
mocks.verify_partial_doubles = true
|
47
|
+
end
|
48
|
+
|
49
|
+
# The settings below are suggested to provide a good initial experience
|
50
|
+
# with RSpec, but feel free to customize to your heart's content.
|
51
|
+
=begin
|
52
|
+
# These two settings work together to allow you to limit a spec run
|
53
|
+
# to individual examples or groups you care about by tagging them with
|
54
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
55
|
+
# get run.
|
56
|
+
config.filter_run :focus
|
57
|
+
config.run_all_when_everything_filtered = true
|
58
|
+
|
59
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
60
|
+
# recommended. For more details, see:
|
61
|
+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
62
|
+
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
63
|
+
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
|
64
|
+
config.disable_monkey_patching!
|
65
|
+
|
66
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
67
|
+
# be too noisy due to issues in dependencies.
|
68
|
+
config.warnings = true
|
69
|
+
|
70
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
71
|
+
# file, and it's useful to allow more verbose output when running an
|
72
|
+
# individual spec file.
|
73
|
+
if config.files_to_run.one?
|
74
|
+
# Use the documentation formatter for detailed output,
|
75
|
+
# unless a formatter has already been configured
|
76
|
+
# (e.g. via a command-line flag).
|
77
|
+
config.default_formatter = 'doc'
|
78
|
+
end
|
79
|
+
|
80
|
+
# Print the 10 slowest examples and example groups at the
|
81
|
+
# end of the spec run, to help surface which specs are running
|
82
|
+
# particularly slow.
|
83
|
+
config.profile_examples = 10
|
84
|
+
|
85
|
+
# Run specs in random order to surface order dependencies. If you find an
|
86
|
+
# order dependency and want to debug it, you can fix the order by providing
|
87
|
+
# the seed, which is printed after each run.
|
88
|
+
# --seed 1234
|
89
|
+
config.order = :random
|
90
|
+
|
91
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
92
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
93
|
+
# test failures related to randomization by passing the same `--seed` value
|
94
|
+
# as the one that triggered the failure.
|
95
|
+
Kernel.srand config.seed
|
96
|
+
=end
|
97
|
+
end
|
metadata
ADDED
@@ -0,0 +1,157 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: readypulse
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Chad Metcalf
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-06-02 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec-its
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec-collection_matchers
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: guard-rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: Readypulse API wrapper.
|
98
|
+
email:
|
99
|
+
- cmetcalf@nerdery.com
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".gitignore"
|
105
|
+
- ".rspec"
|
106
|
+
- ".ruby-version"
|
107
|
+
- Gemfile
|
108
|
+
- LICENSE
|
109
|
+
- LICENSE.txt
|
110
|
+
- README.md
|
111
|
+
- Rakefile
|
112
|
+
- docs/json_schema.md
|
113
|
+
- lib/readypulse.rb
|
114
|
+
- lib/readypulse/album.rb
|
115
|
+
- lib/readypulse/client.rb
|
116
|
+
- lib/readypulse/image.rb
|
117
|
+
- lib/readypulse/image_collection.rb
|
118
|
+
- lib/readypulse/image_type.rb
|
119
|
+
- lib/readypulse/version.rb
|
120
|
+
- readypulse.gemspec
|
121
|
+
- spec/lib/readypulse/album_spec.rb
|
122
|
+
- spec/lib/readypulse/client_spec.rb
|
123
|
+
- spec/lib/readypulse/image_collection_spec.rb
|
124
|
+
- spec/lib/readypulse/image_spec.rb
|
125
|
+
- spec/lib/readypulse/image_type_spec.rb
|
126
|
+
- spec/spec_helper.rb
|
127
|
+
homepage: ''
|
128
|
+
licenses:
|
129
|
+
- MIT
|
130
|
+
metadata: {}
|
131
|
+
post_install_message:
|
132
|
+
rdoc_options: []
|
133
|
+
require_paths:
|
134
|
+
- lib
|
135
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - ">="
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - ">="
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0'
|
145
|
+
requirements: []
|
146
|
+
rubyforge_project:
|
147
|
+
rubygems_version: 2.4.3
|
148
|
+
signing_key:
|
149
|
+
specification_version: 4
|
150
|
+
summary: Readypulse API wrapper.
|
151
|
+
test_files:
|
152
|
+
- spec/lib/readypulse/album_spec.rb
|
153
|
+
- spec/lib/readypulse/client_spec.rb
|
154
|
+
- spec/lib/readypulse/image_collection_spec.rb
|
155
|
+
- spec/lib/readypulse/image_spec.rb
|
156
|
+
- spec/lib/readypulse/image_type_spec.rb
|
157
|
+
- spec/spec_helper.rb
|