artk 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- MWFjNGMyOWUwMWE1ZmNmOTJkMDY0ZTE5ZGNjYmJjNjAwZTU2Y2U4OQ==
5
- data.tar.gz: !binary |-
6
- OGU0YTQxMWQ1ZDUzYjQ3NzU4MmY4OGM3YmVlYjVkZTMzNDdlNjBiMw==
2
+ SHA1:
3
+ metadata.gz: d6fd2c469afa569e5c82d81414c6738760e31a76
4
+ data.tar.gz: 2e9279e7cbc5f28bdec1cacf475355a786bc0ff6
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- MjljNDFhMmJjMjczYWViN2M1ZDQ3MDAxMDUxYTkyY2QwN2FmODUwOTllOWNi
10
- ZDhjNzMyMWRiNTkxY2Q5NTVlZjk4MGYyYzRlOGEzMDM0MTkyYWI3MjliZjEz
11
- MjFiZGNjMjM1NDY2N2RlYjM2NmIzZTVkY2Y5NDdiMGU3N2YxODg=
12
- data.tar.gz: !binary |-
13
- ZTgwMTNkMzE3OTBkMTU1NGM1Nzg2NDBhZjgyOGExMWRhOTBmYjkxYWE0ZjZl
14
- NjlkZWM5ZGY3MThkODA2NGE5MWYxNThlMzQ5YWJiZDg4ZjkzZTFiZjhhNjIx
15
- ZDY4MGFmNWQ4ZTM3YjhkODM4NDQ0ODdmNDY0NTlkYjJhOGJlYjI=
6
+ metadata.gz: 9ee856282d6a018546b3dda0f8e1bfe8ef6d579a247ad1403824d772226c5a87fb1bde4ba5f10fa0b0cc4a965b4770d917e30cbbaa8bc698b86451744a3609bd
7
+ data.tar.gz: 8080018c1d60d8930827852d005be66eb316469c60f6f25fcbaf3aea2421e472ceffdcf12b4e2c65652bfb088e4d0645c1ef183edca4d6219669762f21e270fb
@@ -0,0 +1,9 @@
1
+ module Artk
2
+ class InstancesController < Artk::ApplicationController
3
+
4
+ def index
5
+ @instances = Resource.find_by_ead_id(params[:resource_id]).component(params[:component_id]).instances
6
+ end
7
+
8
+ end
9
+ end
@@ -3,6 +3,7 @@ class Component < Artk::Base
3
3
 
4
4
  belongs_to :resource, :foreign_key => "resourceId"
5
5
  has_many :sub_components, :class_name => "Component", :foreign_key => "parentResourceComponentId"
6
+ has_many :instances, :class_name => "Instance", :foreign_key => "resourceComponentId"
6
7
 
7
8
  def self.table_name
8
9
  "ResourcesComponents"
@@ -21,4 +22,4 @@ class Component < Artk::Base
21
22
  end
22
23
 
23
24
  end
24
- end
25
+ end
@@ -0,0 +1,16 @@
1
+ module Artk
2
+ class Instance < Artk::Base
3
+
4
+ belongs_to :component, :foreign_key => "resourceComponentId"
5
+ belongs_to :location, :foreign_key => "locationId"
6
+
7
+ def self.table_name
8
+ "ArchDescriptionInstances"
9
+ end
10
+
11
+ def self.primary_key
12
+ "archDescriptionInstancesId"
13
+ end
14
+
15
+ end
16
+ end
@@ -0,0 +1,43 @@
1
+ module Artk
2
+ class Location < Artk::Base
3
+
4
+ has_many :instances, :foreign_key => "locationId"
5
+
6
+ def self.table_name
7
+ "LocationsTable"
8
+ end
9
+
10
+ def self.primary_key
11
+ "locationId"
12
+ end
13
+
14
+ def coordinate_value i
15
+ if self.alphanumeric_indicator(i).blank?
16
+ formatted_numeric_indicator self.numeric_indicator(i)
17
+ else
18
+ [formatted_numeric_indicator(self.numeric_indicator(i)), alphanumeric_indicator(i)].join
19
+ end
20
+ end
21
+
22
+ def coordinate_label i
23
+ self.send("coordinate"+i.to_s+"Label")
24
+ end
25
+
26
+ def numeric_indicator i
27
+ self.send("coordinate" + i.to_s + "NumericIndicator")
28
+ end
29
+
30
+ def alphanumeric_indicator i
31
+ self.send("coordinate" + i.to_s + "AlphaNumIndicator")
32
+ end
33
+
34
+ private
35
+
36
+ def formatted_numeric_indicator i
37
+ if i > 0
38
+ i.to_i.to_s
39
+ end
40
+ end
41
+
42
+ end
43
+ end
@@ -62,4 +62,4 @@ class Resource < Artk::Base
62
62
  end
63
63
 
64
64
  end
65
- end
65
+ end
@@ -5,7 +5,9 @@ Artk::Engine.routes.draw do
5
5
  # /resources/ARC-0001/components
6
6
 
7
7
  resources :resources, :only => [:index, :show] do
8
- resources :components, :only => [:index, :show]
8
+ resources :components, :only => [:index, :show] do
9
+ resources :instances, :only => [:index]
10
+ end
9
11
  end
10
12
 
11
13
  resources :accessions, :only => [:index]
@@ -1,3 +1,3 @@
1
1
  module Artk
2
- VERSION = "0.3.1"
2
+ VERSION = "0.4.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: artk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Wead
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-10 00:00:00.000000000 Z
11
+ date: 2014-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -28,56 +28,56 @@ dependencies:
28
28
  name: sqlite3
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ! '>='
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ! '>='
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: mysql2
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ! '>='
45
+ - - '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ! '>='
52
+ - - '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec-rails
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ! '>='
59
+ - - '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ! '>='
66
+ - - '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: debugger
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ! '>='
73
+ - - '>='
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ! '>='
80
+ - - '>='
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  description: Provides a Rails interface to Archivist's Toolkit
@@ -87,30 +87,34 @@ executables: []
87
87
  extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
+ - LICENSE
91
+ - README.md
92
+ - Rakefile
90
93
  - app/assets/javascripts/artk/application.js
91
94
  - app/assets/stylesheets/artk/application.css
92
95
  - app/controllers/artk/accessions_controller.rb
93
96
  - app/controllers/artk/application_controller.rb
94
97
  - app/controllers/artk/components_controller.rb
98
+ - app/controllers/artk/instances_controller.rb
95
99
  - app/controllers/artk/resources_controller.rb
96
100
  - app/helpers/artk/application_helper.rb
97
101
  - app/models/artk/accession.rb
98
102
  - app/models/artk/base.rb
99
103
  - app/models/artk/component.rb
104
+ - app/models/artk/instance.rb
105
+ - app/models/artk/location.rb
100
106
  - app/models/artk/resource.rb
101
107
  - app/views/artk/components/index.html.erb
102
108
  - app/views/artk/components/show.html.erb
109
+ - app/views/artk/instances/index.html.erb
103
110
  - app/views/artk/resources/index.html.erb
104
111
  - app/views/artk/resources/show.html.erb
105
112
  - app/views/layouts/artk.html.erb
106
113
  - config/routes.rb
114
+ - lib/artk.rb
107
115
  - lib/artk/engine.rb
108
116
  - lib/artk/version.rb
109
- - lib/artk.rb
110
117
  - lib/tasks/artk_tasks.rake
111
- - LICENSE
112
- - Rakefile
113
- - README.md
114
118
  homepage: https://github.com/awead/artk
115
119
  licenses:
116
120
  - Apache-2
@@ -121,17 +125,17 @@ require_paths:
121
125
  - lib
122
126
  required_ruby_version: !ruby/object:Gem::Requirement
123
127
  requirements:
124
- - - ! '>='
128
+ - - '>='
125
129
  - !ruby/object:Gem::Version
126
130
  version: '0'
127
131
  required_rubygems_version: !ruby/object:Gem::Requirement
128
132
  requirements:
129
- - - ! '>='
133
+ - - '>='
130
134
  - !ruby/object:Gem::Version
131
135
  version: '0'
132
136
  requirements: []
133
137
  rubyforge_project:
134
- rubygems_version: 2.1.11
138
+ rubygems_version: 2.2.2
135
139
  signing_key:
136
140
  specification_version: 4
137
141
  summary: Provides a Rails interface to Archivist's Toolkit