magnifier 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -2
- data/config/magnifier_options.yml +3 -0
- data/lib/generators/magnifier_generator.rb +30 -0
- data/lib/magnifier.rb +4 -13
- data/lib/magnifier/page.rb +11 -0
- data/lib/magnifier/page_element.rb +20 -0
- data/lib/magnifier/project.rb +12 -0
- data/lib/magnifier/railtie.rb +7 -0
- data/lib/magnifier/version.rb +1 -1
- data/magnifier.gemspec +3 -1
- metadata +11 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0386e1e55cd76eea5ccb2e630d9c74beda25f267
|
4
|
+
data.tar.gz: f08e29e09e25797eba6709d179a9b7659e7dee33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c45aad99e85ecb1508026099c13d89be3a81c7727a090314cc1b7663e342546373e23e18b51e6feb8533fa7a7459895ff74921328ea6116358a4da613a3df666
|
7
|
+
data.tar.gz: fef1f8d0c814c2ff3f373302b01c9b64488725a4831aafab4a7b29064c3133545edaeb01d17f457a5bc796a9d517eba76d1c4a228c7a1b0517bbfe7274e346ef
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Magnifier
|
2
2
|
|
3
|
-
|
3
|
+
Magnifier makes it possible to communicate with the Eskes Media Magazine Maker engine and perform various tasks (duplicate, make_preview, etc.) to projects, without having to deal with the API directly. To communicate with the API, you need an API-key, provided by the Magazine Maker.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -12,13 +12,23 @@ And then execute:
|
|
12
12
|
|
13
13
|
$ bundle
|
14
14
|
|
15
|
+
# after installation, run this command to install the settings file (.yml)
|
16
|
+
$ rails generate magnifier
|
17
|
+
|
15
18
|
Or install it yourself as:
|
16
19
|
|
17
20
|
$ gem install magnifier
|
18
21
|
|
19
22
|
## Usage
|
20
23
|
|
21
|
-
|
24
|
+
### Project
|
25
|
+
- To fetch a list of all projects: `Magnifier::Project.all`
|
26
|
+
- To fetch a project: `Magnifier::Project.find(123)`
|
27
|
+
|
28
|
+
#### Public methods
|
29
|
+
# duplicate
|
30
|
+
# duplicates the current project. Example:
|
31
|
+
new_project = Project.find(123).duplicate
|
22
32
|
|
23
33
|
## Contributing
|
24
34
|
|
@@ -0,0 +1,30 @@
|
|
1
|
+
class MagnifierGenerator < Rails::Generators::Base
|
2
|
+
|
3
|
+
source_root File.join(File.dirname(__FILE__), "templates")
|
4
|
+
|
5
|
+
# Description:
|
6
|
+
# Copies the migration file into the application.
|
7
|
+
def install
|
8
|
+
# Example:
|
9
|
+
# rails generate magnifier
|
10
|
+
|
11
|
+
copy_options_file
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
def copy_options_file
|
19
|
+
copy_file File.join(config_path, 'magnifier_options.yml'), config_destination
|
20
|
+
end
|
21
|
+
|
22
|
+
def config_path
|
23
|
+
File.join(%w(.. .. .. config))
|
24
|
+
end
|
25
|
+
|
26
|
+
def config_destination
|
27
|
+
'config/magnifier_options.yml'
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
data/lib/magnifier.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "magnifier/version"
|
2
|
+
|
2
3
|
require 'magnifier/railtie' if defined?(Rails)
|
3
4
|
|
4
5
|
module Magnifier
|
@@ -20,20 +21,10 @@ module Magnifier
|
|
20
21
|
end
|
21
22
|
end
|
22
23
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
end
|
27
|
-
|
28
|
-
class Page < ActiveResource::Base
|
29
|
-
headers['X-AUTH-TOKEN'] = Settings.api_key
|
30
|
-
self.site = Settings.site
|
31
|
-
end
|
24
|
+
require "magnifier/project"
|
25
|
+
require "magnifier/page"
|
26
|
+
require "magnifier/page_element"
|
32
27
|
|
33
|
-
class PageElement < ActiveResource::Base
|
34
|
-
headers['X-AUTH-TOKEN'] = Settings.api_key
|
35
|
-
self.site = Settings.site
|
36
|
-
end
|
37
28
|
|
38
29
|
# private
|
39
30
|
|
@@ -0,0 +1,11 @@
|
|
1
|
+
include Magnifier
|
2
|
+
|
3
|
+
class Page < ActiveResource::Base
|
4
|
+
headers['X-AUTH-TOKEN'] = Settings.api_key
|
5
|
+
self.site = Settings.site
|
6
|
+
|
7
|
+
# forces the magazin make engine to produce a new preview of this page
|
8
|
+
def make_preview
|
9
|
+
self.get :make_preview
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
include Magnifier
|
2
|
+
class PageElement < ActiveResource::Base
|
3
|
+
headers['X-AUTH-TOKEN'] = Settings.api_key
|
4
|
+
self.site = Settings.site
|
5
|
+
|
6
|
+
def replace_content(old_value, new_value)
|
7
|
+
if content.include? old_value
|
8
|
+
c = content.gsub(old_value, new_value)
|
9
|
+
self.content = c
|
10
|
+
self.save
|
11
|
+
else
|
12
|
+
return false
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
# upload or use a photo
|
17
|
+
def use_photo(url)
|
18
|
+
self.post :update_with_photo, url: url
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
include Magnifier
|
2
|
+
class Project < ActiveResource::Base
|
3
|
+
headers['X-AUTH-TOKEN'] = Settings.api_key
|
4
|
+
self.site = Settings.site
|
5
|
+
|
6
|
+
# make a copy of the project
|
7
|
+
def duplicate
|
8
|
+
new_project = self.get :pick_template
|
9
|
+
npid = new_project["id"]
|
10
|
+
return Project.find(npid)
|
11
|
+
end
|
12
|
+
end
|
data/lib/magnifier/version.rb
CHANGED
data/magnifier.gemspec
CHANGED
@@ -10,9 +10,11 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["meijerhenk@gmail.com"]
|
11
11
|
spec.description = %q{Communicate with the Eskes Media Magazine Maker}
|
12
12
|
spec.summary = %q{This gem makes it realy easy to communicate to the Magazine Maker in a ruby-esque way.}
|
13
|
-
spec.homepage = "
|
13
|
+
spec.homepage = "https://bitbucket.org/eskes_media/magnify"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
|
+
spec.post_install_message = "Thanks for installing! Please run 'rails generate magnifier' to install the options file."
|
17
|
+
|
16
18
|
spec.files = `git ls-files`.split($/)
|
17
19
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
20
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: magnifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henk Meijer
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-06-
|
12
|
+
date: 2013-06-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -51,14 +51,21 @@ files:
|
|
51
51
|
- LICENSE.txt
|
52
52
|
- README.md
|
53
53
|
- Rakefile
|
54
|
+
- config/magnifier_options.yml
|
55
|
+
- lib/generators/magnifier_generator.rb
|
54
56
|
- lib/magnifier.rb
|
57
|
+
- lib/magnifier/page.rb
|
58
|
+
- lib/magnifier/page_element.rb
|
59
|
+
- lib/magnifier/project.rb
|
60
|
+
- lib/magnifier/railtie.rb
|
55
61
|
- lib/magnifier/version.rb
|
56
62
|
- magnifier.gemspec
|
57
|
-
homepage:
|
63
|
+
homepage: https://bitbucket.org/eskes_media/magnify
|
58
64
|
licenses:
|
59
65
|
- MIT
|
60
66
|
metadata: {}
|
61
|
-
post_install_message:
|
67
|
+
post_install_message: Thanks for installing! Please run 'rails generate magnifier'
|
68
|
+
to install the options file.
|
62
69
|
rdoc_options: []
|
63
70
|
require_paths:
|
64
71
|
- lib
|