asset_host_client 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/.travis.yml +4 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +54 -0
- data/Rakefile +14 -0
- data/asset_host_client.gemspec +30 -0
- data/config.ru +11 -0
- data/lib/asset_host.rb +12 -0
- data/lib/asset_host/asset.rb +153 -0
- data/lib/asset_host/asset_size.rb +19 -0
- data/lib/asset_host_client.rb +7 -0
- data/lib/asset_host_client/version.rb +3 -0
- data/spec/fixtures/asset.json +85 -0
- data/spec/fixtures/outputs.json +112 -0
- data/spec/internal/config/database.yml +3 -0
- data/spec/internal/config/initializers/asset_host_config.rb +6 -0
- data/spec/internal/config/routes.rb +3 -0
- data/spec/internal/db/schema.rb +3 -0
- data/spec/internal/lib/asset_host/fallback/asset.json +87 -0
- data/spec/internal/lib/asset_host/fallback/outputs.json +112 -0
- data/spec/internal/log/.gitignore +1 -0
- data/spec/internal/public/favicon.ico +0 -0
- data/spec/lib/asset_host/asset_size_spec.rb +14 -0
- data/spec/lib/asset_host/asset_spec.rb +112 -0
- data/spec/spec_helper.rb +47 -0
- data/spec/support/json_loader.rb +13 -0
- metadata +218 -0
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Bryan Ricker
|
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,54 @@
|
|
1
|
+
# AssetHostClient
|
2
|
+
|
3
|
+
Client for AssetHost API interaction.
|
4
|
+
|
5
|
+
[![Build Status](https://travis-ci.org/SCPR/asset_host_client.png?branch=master)](https://travis-ci.org/SCPR/asset_host_client)
|
6
|
+
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
gem 'asset_host_client'
|
11
|
+
|
12
|
+
The gem is "AssetHostClient", so it doesn't get mixed up with "AssetHost".
|
13
|
+
However, it creates and/or extends the "AssetHost" module.
|
14
|
+
|
15
|
+
|
16
|
+
## Usage
|
17
|
+
|
18
|
+
### Configuration
|
19
|
+
|
20
|
+
Configure your app to connect to assethost, either in an initializer or your environment files:
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
config.assethost = ActiveSupport::OrderedOptions.new
|
24
|
+
|
25
|
+
config.assethost.server = "assets.yoursite.org"
|
26
|
+
config.assethost.token = "{your assethost token}"
|
27
|
+
config.assethost.prefix = "/api"
|
28
|
+
```
|
29
|
+
|
30
|
+
|
31
|
+
### Finding
|
32
|
+
|
33
|
+
`AssetHost::Asset.find(asset_id)`
|
34
|
+
|
35
|
+
You should also provide fallback JSON files at
|
36
|
+
`lib/asset_host_client/fallback/asset.json` and
|
37
|
+
`lib/asset_host_client/fallback/outputs.json`.
|
38
|
+
|
39
|
+
This is so that if the API is unavailable for some reason, it won't bring
|
40
|
+
your entire website down. You can override that path by setting
|
41
|
+
`AssetHost.fallback_root = Rails.root.join('lib', 'fallbacks')`
|
42
|
+
in an initializer.
|
43
|
+
|
44
|
+
|
45
|
+
### Creating
|
46
|
+
|
47
|
+
`AssetHost::Asset.create(attributes)`
|
48
|
+
|
49
|
+
|
50
|
+
## Contributing
|
51
|
+
|
52
|
+
Sure!
|
53
|
+
|
54
|
+
`rake test` to run tests.
|
data/Rakefile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
RAKED = true
|
3
|
+
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'rdoc/task'
|
6
|
+
require 'rspec/core/rake_task'
|
7
|
+
require 'combustion'
|
8
|
+
|
9
|
+
Bundler.require :default, :test
|
10
|
+
Combustion.initialize!
|
11
|
+
Combustion::Application.load_tasks
|
12
|
+
|
13
|
+
RSpec::Core::RakeTask.new(:test)
|
14
|
+
task default: :test
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'asset_host_client/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "asset_host_client"
|
8
|
+
spec.version = AssetHostClient::VERSION
|
9
|
+
spec.authors = ["Bryan Ricker", "Eric Richardson"]
|
10
|
+
spec.email = ["bricker88@gmail.com"]
|
11
|
+
spec.description = %q{Ruby client for AssetHost}
|
12
|
+
spec.summary = %q{Ruby client for AssetHost API interaction.}
|
13
|
+
spec.homepage = "https://github.com/SCPR/asset_host_client"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
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_dependency "rails", ">= 3.0"
|
22
|
+
spec.add_dependency "faraday", "~> 0.8"
|
23
|
+
spec.add_dependency "faraday_middleware", "~> 0.8"
|
24
|
+
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
26
|
+
spec.add_development_dependency "rake"
|
27
|
+
spec.add_development_dependency "rspec-rails"
|
28
|
+
spec.add_development_dependency "combustion"
|
29
|
+
spec.add_development_dependency "fakeweb"
|
30
|
+
end
|
data/config.ru
ADDED
data/lib/asset_host.rb
ADDED
@@ -0,0 +1,153 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
require 'faraday_middleware'
|
3
|
+
|
4
|
+
module AssetHost
|
5
|
+
class Asset
|
6
|
+
class Fallback < Asset
|
7
|
+
def initialize
|
8
|
+
json = JSON.parse(File.read(File.join(AssetHost.fallback_root, "asset.json")))
|
9
|
+
super(json)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
BAD_STATUS = [400, 404, 500, 502]
|
14
|
+
GOOD_STATUS = [200]
|
15
|
+
|
16
|
+
#-------------------
|
17
|
+
|
18
|
+
class << self
|
19
|
+
def config
|
20
|
+
@config ||= Rails.application.config.assethost
|
21
|
+
end
|
22
|
+
|
23
|
+
#-------------------
|
24
|
+
|
25
|
+
def outputs
|
26
|
+
@outputs ||= begin
|
27
|
+
key = "assets/outputs"
|
28
|
+
|
29
|
+
if cached = Rails.cache.read(key)
|
30
|
+
return cached
|
31
|
+
end
|
32
|
+
|
33
|
+
response = connection.get "#{config.prefix}/outputs"
|
34
|
+
|
35
|
+
if !GOOD_STATUS.include? response.status
|
36
|
+
outputs = JSON.parse(File.read(File.join(AssetHost.fallback_root, "outputs.json")))
|
37
|
+
else
|
38
|
+
outputs = response.body
|
39
|
+
Rails.cache.write(key, outputs)
|
40
|
+
end
|
41
|
+
|
42
|
+
outputs
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
#-------------------
|
47
|
+
|
48
|
+
# asset = Asset.find(id)
|
49
|
+
# Given an asset ID, returns an asset object
|
50
|
+
def find(id)
|
51
|
+
key = "asset/asset-#{id}"
|
52
|
+
|
53
|
+
if cached = Rails.cache.read(key)
|
54
|
+
return new(cached)
|
55
|
+
end
|
56
|
+
|
57
|
+
response = connection.get "#{config.prefix}/assets/#{id}"
|
58
|
+
json = response.body
|
59
|
+
|
60
|
+
if !GOOD_STATUS.include?(response.status.to_i) || !json
|
61
|
+
asset = Fallback.new
|
62
|
+
else
|
63
|
+
asset = new(json)
|
64
|
+
Rails.cache.write(key, json)
|
65
|
+
end
|
66
|
+
|
67
|
+
asset
|
68
|
+
end
|
69
|
+
|
70
|
+
|
71
|
+
#-----------------
|
72
|
+
|
73
|
+
def create(attributes={})
|
74
|
+
response = connection.post do |request|
|
75
|
+
request.url "#{config.prefix}/assets"
|
76
|
+
request.body = attributes
|
77
|
+
end
|
78
|
+
|
79
|
+
json = response.body
|
80
|
+
|
81
|
+
if response.success? && json
|
82
|
+
asset = new(json)
|
83
|
+
Rails.cache.write("asset/asset-#{asset.id}", json)
|
84
|
+
else
|
85
|
+
return false
|
86
|
+
end
|
87
|
+
|
88
|
+
asset
|
89
|
+
end
|
90
|
+
|
91
|
+
|
92
|
+
def connection
|
93
|
+
@connection ||= begin
|
94
|
+
Faraday.new(
|
95
|
+
:url => "http://#{config.server}",
|
96
|
+
:params => { auth_token: config.token }
|
97
|
+
) do |conn|
|
98
|
+
conn.request :json
|
99
|
+
conn.response :json
|
100
|
+
conn.adapter Faraday.default_adapter
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
#----------
|
107
|
+
|
108
|
+
ATTRIBUTES = [
|
109
|
+
:caption,
|
110
|
+
:title,
|
111
|
+
:id,
|
112
|
+
:size,
|
113
|
+
:taken_at,
|
114
|
+
:owner,
|
115
|
+
:url,
|
116
|
+
:api_url,
|
117
|
+
:native,
|
118
|
+
:image_file_size
|
119
|
+
]
|
120
|
+
|
121
|
+
attr_accessor :json
|
122
|
+
attr_accessor *ATTRIBUTES
|
123
|
+
|
124
|
+
def initialize(json)
|
125
|
+
@json = json
|
126
|
+
@_sizes = {}
|
127
|
+
|
128
|
+
ATTRIBUTES.map(&:to_s).each do |attribute|
|
129
|
+
send "#{attribute}=", @json[attribute]
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
#----------
|
134
|
+
|
135
|
+
def _size(output)
|
136
|
+
@_sizes[ output['code'] ] ||= AssetSize.new(self, output)
|
137
|
+
end
|
138
|
+
|
139
|
+
#----------
|
140
|
+
|
141
|
+
def as_json(options={})
|
142
|
+
@json
|
143
|
+
end
|
144
|
+
|
145
|
+
def method_missing(method, *args)
|
146
|
+
if output = Asset.outputs.find { |output| output['code'] == method.to_s }
|
147
|
+
self._size(output)
|
148
|
+
else
|
149
|
+
super
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module AssetHost
|
2
|
+
class AssetSize
|
3
|
+
attr_accessor :width, :height, :tag, :url, :asset, :output
|
4
|
+
|
5
|
+
def initialize(asset, output)
|
6
|
+
@asset = asset
|
7
|
+
@output = output
|
8
|
+
|
9
|
+
self.width = @asset.json['sizes'][ output['code'] ]['width']
|
10
|
+
self.height = @asset.json['sizes'][ output['code'] ]['height']
|
11
|
+
self.tag = @asset.json['tags'][ output['code'] ]
|
12
|
+
self.url = @asset.json['urls'][ output['code'] ]
|
13
|
+
end
|
14
|
+
|
15
|
+
def tag
|
16
|
+
@tag.html_safe
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
{
|
2
|
+
"id": 55966,
|
3
|
+
"title": "Futurama",
|
4
|
+
"caption": "Futurama is brought to you by... Glagnar's Human Rinds! It's a buncha muncha cruncha human!",
|
5
|
+
"owner": "Futurama",
|
6
|
+
"size": "286x257",
|
7
|
+
"sizes": {
|
8
|
+
"thumb": {
|
9
|
+
"width": 86,
|
10
|
+
"height": 87
|
11
|
+
},
|
12
|
+
"lsquare": {
|
13
|
+
"width": 183,
|
14
|
+
"height": 187
|
15
|
+
},
|
16
|
+
"lead": {
|
17
|
+
"width": 286,
|
18
|
+
"height": 257
|
19
|
+
},
|
20
|
+
"wide": {
|
21
|
+
"width": 286,
|
22
|
+
"height": 257
|
23
|
+
},
|
24
|
+
"full": {
|
25
|
+
"width": 286,
|
26
|
+
"height": 257
|
27
|
+
},
|
28
|
+
"six": {
|
29
|
+
"width": 286,
|
30
|
+
"height": 257
|
31
|
+
},
|
32
|
+
"eight": {
|
33
|
+
"width": 286,
|
34
|
+
"height": 257
|
35
|
+
},
|
36
|
+
"four": {
|
37
|
+
"width": 286,
|
38
|
+
"height": 257
|
39
|
+
},
|
40
|
+
"three": {
|
41
|
+
"width": 255,
|
42
|
+
"height": 229
|
43
|
+
},
|
44
|
+
"five": {
|
45
|
+
"width": 286,
|
46
|
+
"height": 257
|
47
|
+
},
|
48
|
+
"small": {
|
49
|
+
"width": 286,
|
50
|
+
"height": 257
|
51
|
+
}
|
52
|
+
},
|
53
|
+
"tags": {
|
54
|
+
"thumb": "<img src=\"http://a.scpr.org/i/8f185f3605ea8bf958ed13feff8919d9/55966-thumb.jpg\" width=\"86\" height=\"87\" alt=\"Futurama\" />",
|
55
|
+
"lsquare": "<img src=\"http://a.scpr.org/i/8f185f3605ea8bf958ed13feff8919d9/55966-lsquare.jpg\" width=\"183\" height=\"187\" alt=\"Futurama\" />",
|
56
|
+
"lead": "<img src=\"http://a.scpr.org/i/8f185f3605ea8bf958ed13feff8919d9/55966-lead.jpg\" width=\"286\" height=\"257\" alt=\"Futurama\" />",
|
57
|
+
"wide": "<img src=\"http://a.scpr.org/i/8f185f3605ea8bf958ed13feff8919d9/55966-wide.jpg\" width=\"286\" height=\"257\" alt=\"Futurama\" />",
|
58
|
+
"full": "<img src=\"http://a.scpr.org/i/8f185f3605ea8bf958ed13feff8919d9/55966-full.jpg\" width=\"286\" height=\"257\" alt=\"Futurama\" />",
|
59
|
+
"six": "<img src=\"http://a.scpr.org/i/8f185f3605ea8bf958ed13feff8919d9/55966-six.jpg\" width=\"286\" height=\"257\" alt=\"Futurama\" />",
|
60
|
+
"eight": "<img src=\"http://a.scpr.org/i/8f185f3605ea8bf958ed13feff8919d9/55966-eight.jpg\" width=\"286\" height=\"257\" alt=\"Futurama\" />",
|
61
|
+
"four": "<img src=\"http://a.scpr.org/i/8f185f3605ea8bf958ed13feff8919d9/55966-four.jpg\" width=\"286\" height=\"257\" alt=\"Futurama\" />",
|
62
|
+
"three": "<img src=\"http://a.scpr.org/i/8f185f3605ea8bf958ed13feff8919d9/55966-three.jpg\" width=\"255\" height=\"229\" alt=\"Futurama\" />",
|
63
|
+
"five": "<img src=\"http://a.scpr.org/i/8f185f3605ea8bf958ed13feff8919d9/55966-five.jpg\" width=\"286\" height=\"257\" alt=\"Futurama\" />",
|
64
|
+
"small": "<img src=\"http://a.scpr.org/i/8f185f3605ea8bf958ed13feff8919d9/55966-small.jpg\" width=\"286\" height=\"257\" alt=\"Futurama\" />"
|
65
|
+
},
|
66
|
+
"urls": {
|
67
|
+
"thumb": "http://a.scpr.org/i/8f185f3605ea8bf958ed13feff8919d9/55966-thumb.jpg",
|
68
|
+
"lsquare": "http://a.scpr.org/i/8f185f3605ea8bf958ed13feff8919d9/55966-lsquare.jpg",
|
69
|
+
"lead": "http://a.scpr.org/i/8f185f3605ea8bf958ed13feff8919d9/55966-lead.jpg",
|
70
|
+
"wide": "http://a.scpr.org/i/8f185f3605ea8bf958ed13feff8919d9/55966-wide.jpg",
|
71
|
+
"full": "http://a.scpr.org/i/8f185f3605ea8bf958ed13feff8919d9/55966-full.jpg",
|
72
|
+
"six": "http://a.scpr.org/i/8f185f3605ea8bf958ed13feff8919d9/55966-six.jpg",
|
73
|
+
"eight": "http://a.scpr.org/i/8f185f3605ea8bf958ed13feff8919d9/55966-eight.jpg",
|
74
|
+
"four": "http://a.scpr.org/i/8f185f3605ea8bf958ed13feff8919d9/55966-four.jpg",
|
75
|
+
"three": "http://a.scpr.org/i/8f185f3605ea8bf958ed13feff8919d9/55966-three.jpg",
|
76
|
+
"five": "http://a.scpr.org/i/8f185f3605ea8bf958ed13feff8919d9/55966-five.jpg",
|
77
|
+
"small": "http://a.scpr.org/i/8f185f3605ea8bf958ed13feff8919d9/55966-small.jpg"
|
78
|
+
},
|
79
|
+
"url": "http://a.scpr.org/api/assets/55966/",
|
80
|
+
"notes": "Fetched from URL: http://i.imgur.com/0csRtwS.png?2",
|
81
|
+
"created_at": "2013-02-28T20:01:46Z",
|
82
|
+
"taken_at": "2013-02-28T20:01:46Z",
|
83
|
+
"native": null,
|
84
|
+
"image_file_size": 99450
|
85
|
+
}
|
@@ -0,0 +1,112 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"code": "thumb",
|
4
|
+
"created_at": "2011-06-24T22:42:13Z",
|
5
|
+
"extension": "jpg",
|
6
|
+
"id": 100,
|
7
|
+
"is_rich": false,
|
8
|
+
"prerender": true,
|
9
|
+
"size": "88x88#",
|
10
|
+
"updated_at": "2012-07-01T06:55:31Z"
|
11
|
+
},
|
12
|
+
{
|
13
|
+
"code": "lsquare",
|
14
|
+
"created_at": "2011-06-24T22:42:13Z",
|
15
|
+
"extension": "jpg",
|
16
|
+
"id": 200,
|
17
|
+
"is_rich": false,
|
18
|
+
"prerender": true,
|
19
|
+
"size": "188x188#",
|
20
|
+
"updated_at": "2012-03-10T00:01:07Z"
|
21
|
+
},
|
22
|
+
{
|
23
|
+
"code": "lead",
|
24
|
+
"created_at": "2011-06-24T22:42:13Z",
|
25
|
+
"extension": "jpg",
|
26
|
+
"id": 300,
|
27
|
+
"is_rich": false,
|
28
|
+
"prerender": false,
|
29
|
+
"size": "324x324>",
|
30
|
+
"updated_at": "2011-06-24T22:42:13Z"
|
31
|
+
},
|
32
|
+
{
|
33
|
+
"code": "wide",
|
34
|
+
"created_at": "2011-06-24T22:42:13Z",
|
35
|
+
"extension": "jpg",
|
36
|
+
"id": 400,
|
37
|
+
"is_rich": true,
|
38
|
+
"prerender": true,
|
39
|
+
"size": "620x414>",
|
40
|
+
"updated_at": "2011-06-24T22:42:13Z"
|
41
|
+
},
|
42
|
+
{
|
43
|
+
"code": "full",
|
44
|
+
"created_at": "2011-06-28T15:58:02Z",
|
45
|
+
"extension": "jpg",
|
46
|
+
"id": 500,
|
47
|
+
"is_rich": true,
|
48
|
+
"prerender": true,
|
49
|
+
"size": "1024x1024>",
|
50
|
+
"updated_at": "2013-03-30T05:44:14Z"
|
51
|
+
},
|
52
|
+
{
|
53
|
+
"code": "six",
|
54
|
+
"created_at": "2011-10-13T19:26:53Z",
|
55
|
+
"extension": "jpg",
|
56
|
+
"id": 600,
|
57
|
+
"is_rich": true,
|
58
|
+
"prerender": false,
|
59
|
+
"size": "540x406>",
|
60
|
+
"updated_at": "2011-10-13T19:26:53Z"
|
61
|
+
},
|
62
|
+
{
|
63
|
+
"code": "eight",
|
64
|
+
"created_at": "2011-10-20T21:51:55Z",
|
65
|
+
"extension": "jpg",
|
66
|
+
"id": 800,
|
67
|
+
"is_rich": true,
|
68
|
+
"prerender": true,
|
69
|
+
"size": "730x486>",
|
70
|
+
"updated_at": "2013-03-30T05:41:10Z"
|
71
|
+
},
|
72
|
+
{
|
73
|
+
"code": "four",
|
74
|
+
"created_at": "2011-12-10T01:40:15Z",
|
75
|
+
"extension": "jpg",
|
76
|
+
"id": 900,
|
77
|
+
"is_rich": false,
|
78
|
+
"prerender": true,
|
79
|
+
"size": "600x350>",
|
80
|
+
"updated_at": "2012-06-20T17:46:15Z"
|
81
|
+
},
|
82
|
+
{
|
83
|
+
"code": "three",
|
84
|
+
"created_at": "2011-12-12T23:11:52Z",
|
85
|
+
"extension": "jpg",
|
86
|
+
"id": 1000,
|
87
|
+
"is_rich": false,
|
88
|
+
"prerender": false,
|
89
|
+
"size": "255x255>",
|
90
|
+
"updated_at": "2011-12-12T23:11:52Z"
|
91
|
+
},
|
92
|
+
{
|
93
|
+
"code": "five",
|
94
|
+
"created_at": "2012-01-03T22:22:14Z",
|
95
|
+
"extension": "jpg",
|
96
|
+
"id": 1100,
|
97
|
+
"is_rich": false,
|
98
|
+
"prerender": true,
|
99
|
+
"size": "600x334>",
|
100
|
+
"updated_at": "2012-06-20T17:41:26Z"
|
101
|
+
},
|
102
|
+
{
|
103
|
+
"code": "small",
|
104
|
+
"created_at": "2013-03-30T05:39:25Z",
|
105
|
+
"extension": "jpg",
|
106
|
+
"id": 1200,
|
107
|
+
"is_rich": false,
|
108
|
+
"prerender": true,
|
109
|
+
"size": "450x450>",
|
110
|
+
"updated_at": "2013-03-30T05:39:25Z"
|
111
|
+
}
|
112
|
+
]
|
@@ -0,0 +1,87 @@
|
|
1
|
+
{
|
2
|
+
"id" : 0,
|
3
|
+
"title" : "Asset Unavailable",
|
4
|
+
"caption" : "We encountered a problem, and this photo is currently unavailable.",
|
5
|
+
"size" : "800x533",
|
6
|
+
|
7
|
+
"sizes" : {
|
8
|
+
"thumb" : {
|
9
|
+
"width" : 88,
|
10
|
+
"height" : 88
|
11
|
+
},
|
12
|
+
"lsquare" : {
|
13
|
+
"width" : 188,
|
14
|
+
"height" : 188
|
15
|
+
},
|
16
|
+
"lead" : {
|
17
|
+
"width" : 324,
|
18
|
+
"height" : 216
|
19
|
+
},
|
20
|
+
"wide" : {
|
21
|
+
"width" : 620,
|
22
|
+
"height" : 413
|
23
|
+
},
|
24
|
+
"full" : {
|
25
|
+
"width" : 800,
|
26
|
+
"height" : 533
|
27
|
+
},
|
28
|
+
"six" : {
|
29
|
+
"width" : 540,
|
30
|
+
"height" : 360
|
31
|
+
},
|
32
|
+
"eight" : {
|
33
|
+
"width" : 729,
|
34
|
+
"height" : 486
|
35
|
+
},
|
36
|
+
"four" : {
|
37
|
+
"width" : 525,
|
38
|
+
"height" : 350
|
39
|
+
},
|
40
|
+
"three" : {
|
41
|
+
"width" : 255,
|
42
|
+
"height" : 170
|
43
|
+
},
|
44
|
+
"five" : {
|
45
|
+
"width" : 501,
|
46
|
+
"height" : 334
|
47
|
+
},
|
48
|
+
"small" : {
|
49
|
+
"width" : 450,
|
50
|
+
"height" : 450
|
51
|
+
}
|
52
|
+
},
|
53
|
+
|
54
|
+
"tags" : {
|
55
|
+
"thumb" : "<img src=\"/assets/fallback-img-rect.png\" width=\"88\" height=\"88\" alt=\"\" />",
|
56
|
+
"lsquare" : "<img src=\"/assets/fallback-img-rect.png\" width=\"188\" height=\"188\" alt=\"\" />",
|
57
|
+
"lead" : "<img src=\"/assets/fallback-img-rect.png\" width=\"324\" height=\"216\" alt=\"\" />",
|
58
|
+
"wide" : "<img src=\"/assets/fallback-img-rect.png\" width=\"620\" height=\"413\" alt=\"\" />",
|
59
|
+
"full" : "<img src=\"/assets/fallback-img-rect.png\" width=\"800\" height=\"533\" alt=\"\" />",
|
60
|
+
"six" : "<img src=\"/assets/fallback-img-rect.png\" width=\"540\" height=\"360\" alt=\"\" />",
|
61
|
+
"eight" : "<img src=\"/assets/fallback-img-rect.png\" width=\"729\" height=\"486\" alt=\"\" />",
|
62
|
+
"four" : "<img src=\"/assets/fallback-img-rect.png\" width=\"525\" height=\"350\" alt=\"\" />",
|
63
|
+
"three" : "<img src=\"/assets/fallback-img-rect.png\" width=\"255\" height=\"170\" alt=\"\" />",
|
64
|
+
"five" : "<img src=\"/assets/fallback-img-rect.png\" width=\"501\" height=\"334\" alt=\"\" />",
|
65
|
+
"small" : "<img src=\"/assets/fallback-img-rect.png\" width=\"450\" height=\"450\" alt=\"\" />"
|
66
|
+
},
|
67
|
+
|
68
|
+
"urls" : {
|
69
|
+
"thumb" : "/assets/fallback-img-rect.png",
|
70
|
+
"lsquare" : "/assets/fallback-img-rect.png",
|
71
|
+
"lead" : "/assets/fallback-img-rect.png",
|
72
|
+
"wide" : "/assets/fallback-img-rect.png",
|
73
|
+
"full" : "/assets/fallback-img-rect.png",
|
74
|
+
"six" : "/assets/fallback-img-rect.png",
|
75
|
+
"eight" : "/assets/fallback-img-rect.png",
|
76
|
+
"four" : "/assets/fallback-img-rect.png",
|
77
|
+
"three" : "/assets/fallback-img-rect.png",
|
78
|
+
"five" : "/assets/fallback-img-rect.png",
|
79
|
+
"small" : "/assets/fallback-img-rect.png"
|
80
|
+
},
|
81
|
+
|
82
|
+
"url" : "/assets/fallback-img-rect.png",
|
83
|
+
"created_at" : "2012-09-12T10:15:04-07:00",
|
84
|
+
"native" : {
|
85
|
+
"video_id" : "0"
|
86
|
+
}
|
87
|
+
}
|
@@ -0,0 +1,112 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"code": "thumb",
|
4
|
+
"created_at": "2011-06-24T22:42:13Z",
|
5
|
+
"extension": "jpg",
|
6
|
+
"id": 1,
|
7
|
+
"is_rich": false,
|
8
|
+
"prerender": true,
|
9
|
+
"size": "88x88#",
|
10
|
+
"updated_at": "2012-07-01T06:55:31Z"
|
11
|
+
},
|
12
|
+
{
|
13
|
+
"code": "lsquare",
|
14
|
+
"created_at": "2011-06-24T22:42:13Z",
|
15
|
+
"extension": "jpg",
|
16
|
+
"id": 2,
|
17
|
+
"is_rich": false,
|
18
|
+
"prerender": true,
|
19
|
+
"size": "188x188#",
|
20
|
+
"updated_at": "2012-03-10T00:01:07Z"
|
21
|
+
},
|
22
|
+
{
|
23
|
+
"code": "lead",
|
24
|
+
"created_at": "2011-06-24T22:42:13Z",
|
25
|
+
"extension": "jpg",
|
26
|
+
"id": 3,
|
27
|
+
"is_rich": false,
|
28
|
+
"prerender": false,
|
29
|
+
"size": "324x324>",
|
30
|
+
"updated_at": "2011-06-24T22:42:13Z"
|
31
|
+
},
|
32
|
+
{
|
33
|
+
"code": "wide",
|
34
|
+
"created_at": "2011-06-24T22:42:13Z",
|
35
|
+
"extension": "jpg",
|
36
|
+
"id": 4,
|
37
|
+
"is_rich": true,
|
38
|
+
"prerender": true,
|
39
|
+
"size": "620x414>",
|
40
|
+
"updated_at": "2011-06-24T22:42:13Z"
|
41
|
+
},
|
42
|
+
{
|
43
|
+
"code": "full",
|
44
|
+
"created_at": "2011-06-28T15:58:02Z",
|
45
|
+
"extension": "jpg",
|
46
|
+
"id": 5,
|
47
|
+
"is_rich": true,
|
48
|
+
"prerender": true,
|
49
|
+
"size": "1024x1024>",
|
50
|
+
"updated_at": "2013-03-30T05:44:14Z"
|
51
|
+
},
|
52
|
+
{
|
53
|
+
"code": "six",
|
54
|
+
"created_at": "2011-10-13T19:26:53Z",
|
55
|
+
"extension": "jpg",
|
56
|
+
"id": 6,
|
57
|
+
"is_rich": true,
|
58
|
+
"prerender": false,
|
59
|
+
"size": "540x406>",
|
60
|
+
"updated_at": "2011-10-13T19:26:53Z"
|
61
|
+
},
|
62
|
+
{
|
63
|
+
"code": "eight",
|
64
|
+
"created_at": "2011-10-20T21:51:55Z",
|
65
|
+
"extension": "jpg",
|
66
|
+
"id": 8,
|
67
|
+
"is_rich": true,
|
68
|
+
"prerender": true,
|
69
|
+
"size": "730x486>",
|
70
|
+
"updated_at": "2013-03-30T05:41:10Z"
|
71
|
+
},
|
72
|
+
{
|
73
|
+
"code": "four",
|
74
|
+
"created_at": "2011-12-10T01:40:15Z",
|
75
|
+
"extension": "jpg",
|
76
|
+
"id": 9,
|
77
|
+
"is_rich": false,
|
78
|
+
"prerender": true,
|
79
|
+
"size": "600x350>",
|
80
|
+
"updated_at": "2012-06-20T17:46:15Z"
|
81
|
+
},
|
82
|
+
{
|
83
|
+
"code": "three",
|
84
|
+
"created_at": "2011-12-12T23:11:52Z",
|
85
|
+
"extension": "jpg",
|
86
|
+
"id": 10,
|
87
|
+
"is_rich": false,
|
88
|
+
"prerender": false,
|
89
|
+
"size": "255x255>",
|
90
|
+
"updated_at": "2011-12-12T23:11:52Z"
|
91
|
+
},
|
92
|
+
{
|
93
|
+
"code": "five",
|
94
|
+
"created_at": "2012-01-03T22:22:14Z",
|
95
|
+
"extension": "jpg",
|
96
|
+
"id": 11,
|
97
|
+
"is_rich": false,
|
98
|
+
"prerender": true,
|
99
|
+
"size": "600x334>",
|
100
|
+
"updated_at": "2012-06-20T17:41:26Z"
|
101
|
+
},
|
102
|
+
{
|
103
|
+
"code": "small",
|
104
|
+
"created_at": "2013-03-30T05:39:25Z",
|
105
|
+
"extension": "jpg",
|
106
|
+
"id": 12,
|
107
|
+
"is_rich": false,
|
108
|
+
"prerender": true,
|
109
|
+
"size": "450x450>",
|
110
|
+
"updated_at": "2013-03-30T05:39:25Z"
|
111
|
+
}
|
112
|
+
]
|
@@ -0,0 +1 @@
|
|
1
|
+
*.log
|
File without changes
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe AssetHost::AssetSize do
|
4
|
+
it "provides access to the asset attributes" do
|
5
|
+
output = AssetHost::Asset.outputs.first
|
6
|
+
asset = AssetHost::Asset.find(1)
|
7
|
+
size = AssetHost::AssetSize.new(asset, output)
|
8
|
+
|
9
|
+
size.width.should be_present
|
10
|
+
size.height.should be_present
|
11
|
+
size.tag.should be_present
|
12
|
+
size.url.should be_present
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,112 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe AssetHost::Asset do
|
4
|
+
describe "outputs" do
|
5
|
+
before :each do
|
6
|
+
AssetHost::Asset.instance_variable_set :@outputs, nil
|
7
|
+
Rails.cache.clear
|
8
|
+
end
|
9
|
+
|
10
|
+
after :all do
|
11
|
+
AssetHost::Asset.instance_variable_set :@outputs, nil
|
12
|
+
Rails.cache.clear
|
13
|
+
end
|
14
|
+
|
15
|
+
it "uses @outputs if it already exists" do
|
16
|
+
AssetHost::Asset.instance_variable_set :@outputs, "Outputs"
|
17
|
+
AssetHost::Asset.outputs.should eq "Outputs"
|
18
|
+
end
|
19
|
+
|
20
|
+
it "uses the cached version if it exists" do
|
21
|
+
Rails.cache.read("assets/outputs").should eq nil
|
22
|
+
Rails.cache.write("assets/outputs", "OUTPUTS!")
|
23
|
+
AssetHost::Asset.outputs.should eq "OUTPUTS!"
|
24
|
+
end
|
25
|
+
|
26
|
+
it "sends a request to the api to get outputs" do
|
27
|
+
outputs = AssetHost::Asset.outputs
|
28
|
+
FakeWeb.last_request.path.should match "/outputs"
|
29
|
+
end
|
30
|
+
|
31
|
+
it "returns fallback outputs if the API can't be reached" do
|
32
|
+
Faraday::Response.any_instance.stub(:status) { 500 }
|
33
|
+
AssetHost::Asset.outputs.should eq(load_fallback("outputs.json"))
|
34
|
+
end
|
35
|
+
|
36
|
+
it "writes to cache on successful API response" do
|
37
|
+
Rails.cache.should_receive(:write).with("assets/outputs", anything)
|
38
|
+
AssetHost::Asset.outputs
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
#---------------------
|
43
|
+
|
44
|
+
describe "find" do
|
45
|
+
it "returns cached asset json if it exists" do
|
46
|
+
Rails.cache.read("asset/asset-1").should eq nil
|
47
|
+
AssetHost::Asset.should_receive(:new).with("AssetHost::Asset #1").and_return("Okedoke")
|
48
|
+
Rails.cache.write("asset/asset-1", "AssetHost::Asset #1")
|
49
|
+
AssetHost::Asset.find(1).should eq "Okedoke"
|
50
|
+
end
|
51
|
+
|
52
|
+
it "sends a request to the API on cache miss" do
|
53
|
+
asset = AssetHost::Asset.find(1)
|
54
|
+
FakeWeb.last_request.path.should match "api/assets/1"
|
55
|
+
end
|
56
|
+
|
57
|
+
context "bad response 500" do
|
58
|
+
before :each do
|
59
|
+
Faraday::Response.any_instance.stub(:status) { 500 }
|
60
|
+
end
|
61
|
+
|
62
|
+
it "Returns a fallback asset" do
|
63
|
+
AssetHost::Asset.find(1).should be_a AssetHost::Asset::Fallback
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
context "bad response 502" do
|
68
|
+
before :each do
|
69
|
+
Faraday::Response.any_instance.stub(:status) { 502 }
|
70
|
+
end
|
71
|
+
|
72
|
+
it "Returns a fallback asset" do
|
73
|
+
AssetHost::Asset.find(1).should be_a AssetHost::Asset::Fallback
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
context "good response" do
|
78
|
+
it "writes to cache" do
|
79
|
+
Rails.cache.should_receive(:write).with("asset/asset-1", load_fixture("asset.json"))
|
80
|
+
AssetHost::Asset.find(1)
|
81
|
+
end
|
82
|
+
|
83
|
+
it "creates a new asset from the json" do
|
84
|
+
AssetHost::Asset.should_receive(:new).with(load_fixture("asset.json"))
|
85
|
+
AssetHost::Asset.find(1)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
#-------------------
|
91
|
+
|
92
|
+
describe '::create' do
|
93
|
+
it 'sends an Asset to the API and builds and object from the response if it is success' do
|
94
|
+
asset = AssetHost::Asset.create({ title: "New Asset" })
|
95
|
+
asset.should be_a AssetHost::Asset
|
96
|
+
end
|
97
|
+
|
98
|
+
it 'returns false if response is not success' do
|
99
|
+
Faraday::Response.any_instance.should_receive(:success?).and_return(false)
|
100
|
+
asset = AssetHost::Asset.create({ title: "New Asset" })
|
101
|
+
asset.should eq false
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
#-------------------
|
106
|
+
|
107
|
+
it "generates AssetHost::Asset Sizes for each output" do
|
108
|
+
asset = AssetHost::Asset.find(1) # stubbed response
|
109
|
+
asset.thumb.should be_a AssetHost::AssetSize
|
110
|
+
asset.lsquare.should be_a AssetHost::AssetSize
|
111
|
+
end
|
112
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'combustion'
|
2
|
+
|
3
|
+
unless defined?(RAKED)
|
4
|
+
Bundler.require :default, :test
|
5
|
+
Combustion.initialize!
|
6
|
+
end
|
7
|
+
|
8
|
+
if ENV['CI']
|
9
|
+
# I don't know why
|
10
|
+
require 'rails/all'
|
11
|
+
end
|
12
|
+
|
13
|
+
require 'rspec/rails'
|
14
|
+
require 'fakeweb'
|
15
|
+
|
16
|
+
Rails.backtrace_cleaner.remove_silencers!
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
FakeWeb.allow_net_connect = false
|
21
|
+
|
22
|
+
AH_JSON = {
|
23
|
+
:asset => File.read(File.expand_path("spec/fixtures/asset.json")),
|
24
|
+
:outputs => File.read(File.expand_path("spec/fixtures/outputs.json"))
|
25
|
+
}
|
26
|
+
|
27
|
+
FakeWeb.register_uri(:get, %r|assets\.mysite\.com\/api\/outputs|, body: AH_JSON[:outputs], content_type: "application/json")
|
28
|
+
FakeWeb.register_uri(:post, %r|assets\.mysite\.com\/api\/assets|, body: AH_JSON[:asset], content_type: "application/json")
|
29
|
+
FakeWeb.register_uri(:get, %r|assets\.mysite\.com\/api\/assets|, body: AH_JSON[:asset], content_type: "application/json")
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
Dir[File.expand_path("spec/support/**/*.rb")].each { |f| require f }
|
34
|
+
|
35
|
+
RSpec.configure do |config|
|
36
|
+
config.mock_with :rspec
|
37
|
+
config.order = "random"
|
38
|
+
config.infer_base_class_for_anonymous_controllers = false
|
39
|
+
config.filter_run focus: true
|
40
|
+
config.run_all_when_everything_filtered = true
|
41
|
+
|
42
|
+
config.include JSONLoader
|
43
|
+
|
44
|
+
config.after :each do
|
45
|
+
Rails.cache.clear
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module JSONLoader
|
2
|
+
def load_fallback(filename)
|
3
|
+
load_json(File.join(AssetHost.fallback_root, filename))
|
4
|
+
end
|
5
|
+
|
6
|
+
def load_fixture(filename)
|
7
|
+
load_json(File.expand_path("spec/fixtures/#{filename}"))
|
8
|
+
end
|
9
|
+
|
10
|
+
def load_json(filename)
|
11
|
+
JSON.parse(File.read(filename))
|
12
|
+
end
|
13
|
+
end
|
metadata
ADDED
@@ -0,0 +1,218 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: asset_host_client
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Bryan Ricker
|
9
|
+
- Eric Richardson
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2013-09-12 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rails
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '3.0'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ! '>='
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '3.0'
|
31
|
+
- !ruby/object:Gem::Dependency
|
32
|
+
name: faraday
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
34
|
+
none: false
|
35
|
+
requirements:
|
36
|
+
- - ~>
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0.8'
|
39
|
+
type: :runtime
|
40
|
+
prerelease: false
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ~>
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0.8'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: faraday_middleware
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.8'
|
55
|
+
type: :runtime
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ~>
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0.8'
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
name: bundler
|
65
|
+
requirement: !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
67
|
+
requirements:
|
68
|
+
- - ~>
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '1.3'
|
71
|
+
type: :development
|
72
|
+
prerelease: false
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ~>
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '1.3'
|
79
|
+
- !ruby/object:Gem::Dependency
|
80
|
+
name: rake
|
81
|
+
requirement: !ruby/object:Gem::Requirement
|
82
|
+
none: false
|
83
|
+
requirements:
|
84
|
+
- - ! '>='
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
87
|
+
type: :development
|
88
|
+
prerelease: false
|
89
|
+
version_requirements: !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
91
|
+
requirements:
|
92
|
+
- - ! '>='
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
- !ruby/object:Gem::Dependency
|
96
|
+
name: rspec-rails
|
97
|
+
requirement: !ruby/object:Gem::Requirement
|
98
|
+
none: false
|
99
|
+
requirements:
|
100
|
+
- - ! '>='
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
type: :development
|
104
|
+
prerelease: false
|
105
|
+
version_requirements: !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
107
|
+
requirements:
|
108
|
+
- - ! '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: combustion
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
none: false
|
115
|
+
requirements:
|
116
|
+
- - ! '>='
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
type: :development
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
none: false
|
123
|
+
requirements:
|
124
|
+
- - ! '>='
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '0'
|
127
|
+
- !ruby/object:Gem::Dependency
|
128
|
+
name: fakeweb
|
129
|
+
requirement: !ruby/object:Gem::Requirement
|
130
|
+
none: false
|
131
|
+
requirements:
|
132
|
+
- - ! '>='
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '0'
|
135
|
+
type: :development
|
136
|
+
prerelease: false
|
137
|
+
version_requirements: !ruby/object:Gem::Requirement
|
138
|
+
none: false
|
139
|
+
requirements:
|
140
|
+
- - ! '>='
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
143
|
+
description: Ruby client for AssetHost
|
144
|
+
email:
|
145
|
+
- bricker88@gmail.com
|
146
|
+
executables: []
|
147
|
+
extensions: []
|
148
|
+
extra_rdoc_files: []
|
149
|
+
files:
|
150
|
+
- .gitignore
|
151
|
+
- .travis.yml
|
152
|
+
- CHANGELOG.md
|
153
|
+
- Gemfile
|
154
|
+
- LICENSE.txt
|
155
|
+
- README.md
|
156
|
+
- Rakefile
|
157
|
+
- asset_host_client.gemspec
|
158
|
+
- config.ru
|
159
|
+
- lib/asset_host.rb
|
160
|
+
- lib/asset_host/asset.rb
|
161
|
+
- lib/asset_host/asset_size.rb
|
162
|
+
- lib/asset_host_client.rb
|
163
|
+
- lib/asset_host_client/version.rb
|
164
|
+
- spec/fixtures/asset.json
|
165
|
+
- spec/fixtures/outputs.json
|
166
|
+
- spec/internal/config/database.yml
|
167
|
+
- spec/internal/config/initializers/asset_host_config.rb
|
168
|
+
- spec/internal/config/routes.rb
|
169
|
+
- spec/internal/db/schema.rb
|
170
|
+
- spec/internal/lib/asset_host/fallback/asset.json
|
171
|
+
- spec/internal/lib/asset_host/fallback/outputs.json
|
172
|
+
- spec/internal/log/.gitignore
|
173
|
+
- spec/internal/public/favicon.ico
|
174
|
+
- spec/lib/asset_host/asset_size_spec.rb
|
175
|
+
- spec/lib/asset_host/asset_spec.rb
|
176
|
+
- spec/spec_helper.rb
|
177
|
+
- spec/support/json_loader.rb
|
178
|
+
homepage: https://github.com/SCPR/asset_host_client
|
179
|
+
licenses:
|
180
|
+
- MIT
|
181
|
+
post_install_message:
|
182
|
+
rdoc_options: []
|
183
|
+
require_paths:
|
184
|
+
- lib
|
185
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
186
|
+
none: false
|
187
|
+
requirements:
|
188
|
+
- - ! '>='
|
189
|
+
- !ruby/object:Gem::Version
|
190
|
+
version: '0'
|
191
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
192
|
+
none: false
|
193
|
+
requirements:
|
194
|
+
- - ! '>='
|
195
|
+
- !ruby/object:Gem::Version
|
196
|
+
version: '0'
|
197
|
+
requirements: []
|
198
|
+
rubyforge_project:
|
199
|
+
rubygems_version: 1.8.25
|
200
|
+
signing_key:
|
201
|
+
specification_version: 3
|
202
|
+
summary: Ruby client for AssetHost API interaction.
|
203
|
+
test_files:
|
204
|
+
- spec/fixtures/asset.json
|
205
|
+
- spec/fixtures/outputs.json
|
206
|
+
- spec/internal/config/database.yml
|
207
|
+
- spec/internal/config/initializers/asset_host_config.rb
|
208
|
+
- spec/internal/config/routes.rb
|
209
|
+
- spec/internal/db/schema.rb
|
210
|
+
- spec/internal/lib/asset_host/fallback/asset.json
|
211
|
+
- spec/internal/lib/asset_host/fallback/outputs.json
|
212
|
+
- spec/internal/log/.gitignore
|
213
|
+
- spec/internal/public/favicon.ico
|
214
|
+
- spec/lib/asset_host/asset_size_spec.rb
|
215
|
+
- spec/lib/asset_host/asset_spec.rb
|
216
|
+
- spec/spec_helper.rb
|
217
|
+
- spec/support/json_loader.rb
|
218
|
+
has_rdoc:
|