imagizer_engine 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a4631e83bc2b0414b55df622f1d9e0003a13cdc6
4
- data.tar.gz: b41f67ac03114f2431e4d8591e934a2df7cae7cd
3
+ metadata.gz: a1c73f8b89a54be6217770666920ce9a87b01cec
4
+ data.tar.gz: '0872b1b643202567c40643cefbb45da8ef86f411'
5
5
  SHA512:
6
- metadata.gz: 4ea9c248875dcad7a292824a1f63763c50d8774721c3d77f4e2ce66ccd4a1c4935e9ccf7518eba2fb6b796d02828ac39dd69e6766f0644fe27a0ddeee1894749
7
- data.tar.gz: 031ca499eb6631d855a68b0c57b13fc6ee67623255532d0b5ea56577f87df6a1efba52b44203ad66c8ba0e82816f7c17dd12142a8df0e553b4307fadee684f55
6
+ metadata.gz: 4c0cc546d993319fd03780ae9338291d193acc66ce2e5e75bd911c56b27e7d3aa37326afaadb33ceb9ec8c7e1364bbdde1b0622172e672f01c43188f5fe51d95
7
+ data.tar.gz: d83f14b71e203d6ec6bf949d8d7b05fae842597d065f500e42214831a13d4d56a2b135172d686b6498388df3f39a016a2c024e69ce8a7b15c5a089697439615b
Binary file
data/.gitignore CHANGED
File without changes
data/Gemfile CHANGED
File without changes
File without changes
data/README.md CHANGED
@@ -80,7 +80,71 @@ user.profile_image_url() => "http://143.123.12.9/path/to/file"
80
80
  user.profile_image_url(:cover) => "http://143.123.12.9/path/to/file?scale=2&crop1,2,3,4"
81
81
 
82
82
  ```
83
-
83
+ Also, there's a method that will return the image metadata parsed JSON:
84
+ ```
85
+ user.profile_image_metadata => {
86
+ fileSize: 4428575,
87
+ width: 4032,
88
+ height: 3024,
89
+ fileType: "jpeg",
90
+ mimeType: "image/jpeg",
91
+ hasAlpha: false,
92
+ colorSpace: "srgb",
93
+ exif: {
94
+ ApertureValue: "2159/1273",
95
+ BrightnessValue: "3497/314",
96
+ ComponentsConfiguration: "1, 2, 3, 0",
97
+ DateTime: "2017:04:02 16:08:21",
98
+ DateTimeDigitized: "2017:04:02 16:08:21",
99
+ DateTimeOriginal: "2017:04:02 16:08:21",
100
+ ExifImageLength: 3024,
101
+ ExifImageWidth: 4032,
102
+ ExifOffset: 180,
103
+ ExifVersion: "48, 50, 50, 49",
104
+ ExposureBiasValue: "0/1",
105
+ ExposureMode: 0,
106
+ ExposureProgram: 2,
107
+ ExposureTime: "1/3690",
108
+ Flash: 24,
109
+ FlashPixVersion: "48, 49, 48, 48",
110
+ FNumber: "9/5",
111
+ FocalLength: "399/100",
112
+ FocalLengthIn35mmFilm: 28,
113
+ ISOSpeedRatings: 20,
114
+ Make: "Apple",
115
+ MeteringMode: 5,
116
+ Model: "iPhone 7",
117
+ Orientation: 1,
118
+ ResolutionUnit: 2,
119
+ SceneCaptureType: 0,
120
+ SceneType: 1,
121
+ SensingMethod: 2,
122
+ ShutterSpeedValue: "29588/2497",
123
+ Software: 10.3,
124
+ SubjectArea: "2015, 1511, 2217, 1330",
125
+ SubSecTimeDigitized: 245,
126
+ SubSecTimeOriginal: 245,
127
+ WhiteBalance: 0,
128
+ XResolution: "72/1",
129
+ YResolution: "72/1"
130
+ },
131
+ faces: [ ],
132
+ server: {
133
+ host: "ip-10-0-1-213",
134
+ ip: "10.0.1.213"
135
+ },
136
+ icc: {
137
+ copyright: "Copyright Apple Inc., 2016",
138
+ description: "Apple Wide Color Sharing Profile",
139
+ manufacturer: "Apple Wide Color Sharing Profile",
140
+ model: "Apple Wide Color Sharing Profile"
141
+ },
142
+ jpeg: {
143
+ colorspace: 2,
144
+ sampling-factor: "2x2,1x1,1x1"
145
+ }
146
+ }
147
+ ```
84
148
 
85
149
  ## Contributing
86
150
 
data/Rakefile CHANGED
File without changes
@@ -19,6 +19,8 @@ Gem::Specification.new do |spec|
19
19
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
20
  spec.require_paths = ["lib"]
21
21
 
22
+ spec.add_runtime_dependency 'activesupport'
23
+
22
24
  spec.add_development_dependency "bundler", "~> 1.7"
23
25
  spec.add_development_dependency "rake", "~> 10.0"
24
26
  spec.add_development_dependency "pry"
Binary file
File without changes
@@ -1,3 +1,7 @@
1
+ require 'net/http'
2
+ require 'json'
3
+ require 'active_support'
4
+
1
5
  module ImagizerEngine
2
6
  module Mount
3
7
  def mount_imagizer_engine(column, original_url_method)
@@ -7,6 +11,18 @@ module ImagizerEngine
7
11
  ImagizerEngine::Url.new.to_url(self.send(original_url_method), version)
8
12
  end
9
13
 
14
+ self.send(:define_method, "#{column}_metadata_url") do ||
15
+ raise NoMethodError, "there's no instance method called #{original_url_method}" unless respond_to?(original_url_method)
16
+ ImagizerEngine::Url.new.to_url(self.send(original_url_method), nil, true)
17
+ end
18
+
19
+ self.send(:define_method, "#{column}_metadata") do ||
20
+ raise NoMethodError, "there's no instance method called #{original_url_method}" unless respond_to?(original_url_method)
21
+ url = send("#{column}_metadata_url")
22
+ response = Net::HTTP.get(URI(url))
23
+ JSON.parse(response).with_indifferent_access
24
+ end
25
+
10
26
  end
11
27
  end
12
28
  end
File without changes
@@ -1,8 +1,8 @@
1
1
  module ImagizerEngine
2
2
  class Url
3
- def to_url(url, version)
3
+ def to_url(url, version, metadata = nil)
4
4
  protocol = ImagizerEngine.use_ssl ? 'https://' : 'http://'
5
- protocol + ImagizerEngine.host + "/" + sanitized_url(url) + process_params(version)
5
+ protocol + ImagizerEngine.host + "/" + sanitized_url(url) + process_params(version, metadata)
6
6
  end
7
7
 
8
8
  private
@@ -11,7 +11,8 @@ module ImagizerEngine
11
11
  url.sub(/^https?\:\/\/?([\da-z\.-]+)\.([a-z\.]{2,6}\/)/, '')
12
12
  end
13
13
 
14
- def process_params(version)
14
+ def process_params(version, metadata = nil)
15
+ return "?meta=true" if metadata
15
16
  return "" if version.nil? || ImagizerEngine[version].nil?
16
17
  temp_params = serialized_processes(version)
17
18
  temp_params.empty? ? "" : "?" + temp_params
@@ -1,3 +1,3 @@
1
1
  module ImagizerEngine
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
Binary file
@@ -46,6 +46,10 @@ describe ImagizerEngine do
46
46
  expect(@instance.image_url(:cover)).to eq("http://141.123.12.9/path/to/file.png?width=250&height=100&scale=2&crop=1,2,3,4")
47
47
  end
48
48
 
49
+ it "should send the correct url with a meta=true" do
50
+ expect(@instance.image_metadata_url).to eq("http://141.123.12.9/path/to/file.png?meta=true")
51
+ end
52
+
49
53
  it "should send the correct url with https if use_ssl is set to true" do
50
54
  ImagizerEngine.use_ssl = true
51
55
  expect(@instance.image_url).to eq("https://141.123.12.9/path/to/file.png")
@@ -46,6 +46,14 @@ describe ImagizerEngine::ActiveRecord do
46
46
  expect(@artwork).to respond_to(:main_image_url)
47
47
  end
48
48
 
49
+ it "should respond to main_image_metadata" do
50
+ expect(@artwork).to respond_to(:main_image_metadata)
51
+ end
52
+
53
+ it "should respond to main_image_metadata_url" do
54
+ expect(@artwork).to respond_to(:main_image_metadata_url)
55
+ end
56
+
49
57
  end
50
58
 
51
59
  end
File without changes
@@ -23,8 +23,4 @@ rescue ActiveRecord::StatementInvalid => e # database already exists
23
23
  end
24
24
  ActiveRecord::Base.establish_connection(dbconfig.merge(:database => database))
25
25
 
26
- ActiveRecord::Migration.verbose = false
27
-
28
- if ActiveRecord::VERSION::STRING >= '4.2'
29
- ActiveRecord::Base.raise_in_transactional_callbacks = true
30
- end
26
+ ActiveRecord::Migration.verbose = false
File without changes
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: imagizer_engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - sfkaos
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-02 00:00:00.000000000 Z
11
+ date: 2017-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activesupport
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: bundler
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -103,17 +117,21 @@ executables: []
103
117
  extensions: []
104
118
  extra_rdoc_files: []
105
119
  files:
120
+ - ".DS_Store"
106
121
  - ".gitignore"
107
122
  - Gemfile
108
123
  - LICENSE.txt
109
124
  - README.md
110
125
  - Rakefile
111
126
  - imagizer_engine.gemspec
127
+ - lib/.DS_Store
112
128
  - lib/imagizer_engine.rb
129
+ - lib/imagizer_engine/.DS_Store
113
130
  - lib/imagizer_engine/mount.rb
114
131
  - lib/imagizer_engine/orm/activerecord.rb
115
132
  - lib/imagizer_engine/url.rb
116
133
  - lib/imagizer_engine/version.rb
134
+ - spec/.DS_Store
117
135
  - spec/imagizer_engine_spec.rb
118
136
  - spec/orm/activerecord_spec.rb
119
137
  - spec/spec_helper.rb
@@ -139,11 +157,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
157
  version: '0'
140
158
  requirements: []
141
159
  rubyforge_project:
142
- rubygems_version: 2.4.5
160
+ rubygems_version: 2.6.8
143
161
  signing_key:
144
162
  specification_version: 4
145
163
  summary: Ruby client for using the Imagizer Media Engine from nvnentify.
146
164
  test_files:
165
+ - spec/.DS_Store
147
166
  - spec/imagizer_engine_spec.rb
148
167
  - spec/orm/activerecord_spec.rb
149
168
  - spec/spec_helper.rb