artirix_data_models-ams 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c54c8c6d7f19509cd0e314b4b19772faefd3dae6
4
+ data.tar.gz: b80d16b771de7601dae66d326dec574018ae0a75
5
+ SHA512:
6
+ metadata.gz: b5aea65e0e7ca25e68e62d2b1738bd6fa19defbbb38578d39ea3e30b7500970cc2075fc7bd2707d9884407dc8b286114e58569737ad049b18b5ad53aee99dc5b
7
+ data.tar.gz: 1a3fce0233017eb4db719311477a2417425cc60d10d342c5148d06b91b02f181a64c06f9444b69f89d415cd07bbd39ab689293967d192d3a2bf04f68656c5292
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.travis.yml ADDED
@@ -0,0 +1,14 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.7
4
+ - 2.3.0
5
+ before_install: gem install bundler -v 1.11.2
6
+
7
+ script: 'bundle exec rake test'
8
+
9
+ notifications:
10
+ email:
11
+ recipients:
12
+ - eturino@artirix.com
13
+ on_failure: change
14
+ on_success: never
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'active_model_serializers', '~> 0.10.0.rc4'
4
+
5
+ # Specify your gem's dependencies in artirix_data_models_ams.gemspec
6
+ gemspec
data/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # ArtirixDataModels::Ams
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/artirix_data_models-ams.svg)](http://badge.fury.io/rb/artirix_data_models-ams)
4
+ [![Build Status](https://travis-ci.org/artirix/artirix_data_models-ams.svg?branch=master)](https://travis-ci.org/artirix/artirix_data_models-ams)
5
+
6
+
7
+ This gems adds the module `ArtirixDataModels::Model::AMSCompliant`
8
+
9
+ important: loading this gem will require `artirix_data_models` and `active_model_serializers`.
10
+
11
+ ## Usage
12
+
13
+ include the module in your ADM model.
14
+
15
+ ```ruby
16
+ class MyModel
17
+ include ArtirixDataModels::Model::OnlyData
18
+ include ArtirixDataModels::Model::AMSCompliant
19
+
20
+ attribute :name
21
+
22
+ attribute :id # needed
23
+
24
+ attribute :public_title, writer_visibility: :public
25
+ attribute :private_title, reader_visibility: :private
26
+
27
+ attribute :remember_me, :and_me, skip: :predicate
28
+ attribute :remember_me2, :and_me2, skip: :presence
29
+ end
30
+ ```
31
+
32
+ In order to work properly, the model has to define:
33
+
34
+ - *`id`*
35
+ - *`updated_at`* or *`_timestamp`*
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList['test/**/*_test.rb']
8
+ end
9
+
10
+ task :default => :test
@@ -0,0 +1,34 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'artirix_data_models/ams/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'artirix_data_models-ams'
8
+ spec.version = ArtirixDataModels::Ams::VERSION
9
+ spec.authors = ['Eduardo Turiño']
10
+ spec.email = ['eturino@artirix.com']
11
+
12
+ spec.summary = 'ActiveModelSerializers support for ArtirixDataModels'
13
+
14
+ spec.homepage = ''
15
+
16
+ # # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
17
+ # # delete this section to allow pushing this gem to any host.
18
+ # if spec.respond_to?(:metadata)
19
+ # spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
20
+ # else
21
+ # raise 'RubyGems 2.0 or newer is required to protect against public gem pushes.'
22
+ # end
23
+
24
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
25
+ spec.bindir = 'exe'
26
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
+ spec.require_paths = ['lib']
28
+
29
+ spec.add_dependency 'artirix_data_models', '~> 0.15'
30
+
31
+ spec.add_development_dependency 'bundler', '~> 1.11'
32
+ spec.add_development_dependency 'rake', '~> 10.0'
33
+ spec.add_development_dependency 'minitest', '~> 5.0'
34
+ end
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "artirix_data_models/ams"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,5 @@
1
+ module ArtirixDataModels
2
+ module Ams
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,12 @@
1
+ require "artirix_data_models/ams/version"
2
+
3
+ require 'artirix_data_models'
4
+ require 'active_model_serializers'
5
+ require 'active_model/serializer'
6
+
7
+ require 'artirix_data_models/model/ams_compliant'
8
+
9
+ module ArtirixDataModels
10
+ module Ams
11
+ end
12
+ end
@@ -0,0 +1,29 @@
1
+
2
+ module ArtirixDataModels::Model::AMSCompliant
3
+ extend ActiveSupport::Concern
4
+
5
+ included do
6
+ include ArtirixDataModels::Model::CacheKey
7
+ include ActiveModel::Serialization
8
+
9
+ unless method_defined? :attributes
10
+ alias_method :attributes, :data_hash
11
+ end
12
+
13
+ unless method_defined? :updated_at
14
+
15
+ if method_defined? :_timestamp
16
+ alias_method :updated_at, :_timestamp
17
+ else
18
+ attr_accessor :updated_at
19
+ end
20
+ end
21
+
22
+ unless method_defined? :read_attribute_for_serialization
23
+ define_method :read_attribute_for_serialization do |key|
24
+ return self.send(key) if respond_to? key
25
+ return nil
26
+ end
27
+ end
28
+ end
29
+ end
metadata ADDED
@@ -0,0 +1,110 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: artirix_data_models-ams
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Eduardo Turiño
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-03-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: artirix_data_models
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.15'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.15'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.11'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.11'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: minitest
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '5.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '5.0'
69
+ description:
70
+ email:
71
+ - eturino@artirix.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - ".travis.yml"
78
+ - Gemfile
79
+ - README.md
80
+ - Rakefile
81
+ - artirix_data_models-ams.gemspec
82
+ - bin/console
83
+ - bin/setup
84
+ - lib/artirix_data_models/ams.rb
85
+ - lib/artirix_data_models/ams/version.rb
86
+ - lib/artirix_data_models/model/ams_compliant.rb
87
+ homepage: ''
88
+ licenses: []
89
+ metadata: {}
90
+ post_install_message:
91
+ rdoc_options: []
92
+ require_paths:
93
+ - lib
94
+ required_ruby_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ required_rubygems_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ requirements: []
105
+ rubyforge_project:
106
+ rubygems_version: 2.5.1
107
+ signing_key:
108
+ specification_version: 4
109
+ summary: ActiveModelSerializers support for ArtirixDataModels
110
+ test_files: []