amee 3.2.1 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. data/CHANGELOG.txt +1 -24
  2. data/Gemfile +7 -8
  3. data/Gemfile.lock +33 -14
  4. data/README.txt +33 -15
  5. data/Rakefile +15 -29
  6. data/VERSION +1 -1
  7. data/amee.gemspec +21 -24
  8. data/lib/amee.rb +11 -0
  9. data/lib/amee/connection.rb +1 -1
  10. data/lib/amee/logger.rb +10 -5
  11. data/lib/amee/rails.rb +12 -16
  12. data/lib/amee/v3.rb +2 -0
  13. data/lib/amee/v3/collection.rb +4 -6
  14. data/lib/amee/v3/connection.rb +0 -5
  15. data/lib/amee/v3/item_definition.rb +12 -19
  16. data/lib/amee/v3/item_value_definition.rb +6 -7
  17. data/lib/amee/v3/item_value_definition_list.rb +3 -3
  18. data/lib/amee/v3/return_value_definition.rb +4 -4
  19. data/spec/amee_spec.rb +1 -1
  20. data/spec/cache_spec.rb +1 -1
  21. data/spec/connection_spec.rb +1 -1
  22. data/spec/data_category_spec.rb +4 -4
  23. data/spec/data_item_spec.rb +5 -5
  24. data/spec/data_item_value_history_spec.rb +1 -1
  25. data/spec/data_item_value_spec.rb +1 -1
  26. data/spec/data_object_spec.rb +1 -1
  27. data/spec/drill_down_spec.rb +1 -1
  28. data/spec/fixtures/itemdef.xml +1 -6
  29. data/spec/fixtures/itemdef_441BF4BEA15B.xml +12 -20
  30. data/spec/item_definition_spec.rb +7 -7
  31. data/spec/item_value_definition_spec.rb +9 -9
  32. data/spec/logger_spec.rb +1 -1
  33. data/spec/object_spec.rb +1 -1
  34. data/spec/parse_helper_spec.rb +1 -1
  35. data/spec/profile_category_spec.rb +19 -19
  36. data/spec/profile_item_spec.rb +16 -16
  37. data/spec/profile_item_value_spec.rb +1 -1
  38. data/spec/profile_object_spec.rb +1 -1
  39. data/spec/profile_spec.rb +1 -1
  40. data/spec/rails_spec.rb +1 -6
  41. data/spec/spec_helper.rb +3 -4
  42. data/spec/user_spec.rb +7 -7
  43. data/spec/v3/connection_spec.rb +11 -11
  44. data/spec/v3/item_definition_spec.rb +13 -15
  45. data/spec/v3/item_value_definition_spec.rb +6 -6
  46. data/spec/v3/return_value_definition_spec.rb +10 -9
  47. metadata +87 -79
  48. data/init.rb +0 -4
  49. data/lib/amee/config.rb +0 -37
  50. data/lib/amee/core-extensions/hash.rb +0 -43
  51. data/rails/init.rb +0 -18
  52. data/spec/fixtures/rails_config.yml +0 -13
  53. data/spec/spec_amee_config.rb +0 -46
data/init.rb DELETED
@@ -1,4 +0,0 @@
1
- # Copyright (C) 2008-2011 AMEE UK Ltd. - http://www.amee.com
2
- # Released as Open Source Software under the BSD 3-Clause license. See LICENSE.txt for details.
3
-
4
- require File.dirname(__FILE__) + "/rails/init"
data/lib/amee/config.rb DELETED
@@ -1,37 +0,0 @@
1
- # Copyright (C) 2008-2011 AMEE UK Ltd. - http://www.amee.com
2
- # Released as Open Source Software under the BSD 3-Clause license. See LICENSE.txt for details.
3
-
4
- module AMEE
5
-
6
- class Config
7
-
8
-
9
- # Tries to load defaults from a yaml file, then if there are environment variables
10
- # present (i.e. if we're using a service like heroku for determine them, or we want to
11
- # manually override them), uses those values instead
12
- def self.setup(amee_config_file = nil, environment = 'test')
13
-
14
- if amee_config_file
15
- # first try loading the yaml file
16
- yaml_config = YAML.load_file(amee_config_file)
17
- config = yaml_config[environment]
18
-
19
- # make config[:username] possible instead of just config['username']
20
- config.recursive_symbolize_keys!
21
- else
22
- config = {}
23
- end
24
-
25
- # then either override, or load in config deets from heroku
26
- config[:username] = ENV['AMEE_USERNAME'] if ENV['AMEE_USERNAME']
27
- config[:server] = ENV['AMEE_SERVER'] if ENV['AMEE_SERVER']
28
- config[:password] = ENV['AMEE_PASSWORD'] if ENV['AMEE_PASSWORD']
29
-
30
- return config
31
-
32
- end
33
-
34
- end
35
-
36
- end
37
-
@@ -1,43 +0,0 @@
1
- # Copyright (C) 2011 AMEE UK Ltd. - http://www.amee.com
2
- # Released as Open Source Software under the BSD 3-Clause license. See LICENSE.txt for details.
3
-
4
- # :title: Class: Hash
5
-
6
- class Hash
7
-
8
- # Return a new instance of <i>Hash</i> which represents the same data as
9
- # <tt>self</tt> but with all keys - including those of sub-hashes - symbolized
10
- #
11
- def recursive_symbolize_keys
12
- new_hash = {}
13
- self.each_pair do |k,v|
14
- new_hash[k.to_sym] = value_or_symbolize_value(v)
15
- end
16
- new_hash
17
- end
18
-
19
- # Modify <tt>self</tt> in place, transforming all keys - including those of
20
- # sub-hashes - in to symbols
21
- #
22
- def recursive_symbolize_keys!
23
- self.each_pair do |k,v|
24
- value = delete(k)
25
- self[k.to_sym] = value_or_symbolize_value(value)
26
- end
27
- self
28
- end
29
-
30
- private
31
-
32
- # Symbolize any hash key or sub-hash key containing within <tt>value</tt>.
33
- def value_or_symbolize_value(value)
34
- if value.is_a? Hash
35
- return value.recursive_symbolize_keys
36
- elsif value.is_a? Array
37
- return value.map { |elem| value_or_symbolize_value(elem) }
38
- else
39
- return value
40
- end
41
- end
42
-
43
- end
data/rails/init.rb DELETED
@@ -1,18 +0,0 @@
1
- # Copyright (C) 2008-2011 AMEE UK Ltd. - http://www.amee.com
2
- # Released as Open Source Software under the BSD 3-Clause license. See LICENSE.txt for details.
3
-
4
- require 'amee'
5
- require 'amee/config'
6
- require 'amee/core-extensions/hash'
7
- require 'amee/rails'
8
-
9
- # Load config/amee.yml
10
- amee_config = "#{Rails.root}/config/amee.yml"
11
- if File.exist? amee_config
12
- $AMEE_CONFIG = AMEE::Config.setup(amee_config, Rails.env)
13
- else
14
- $AMEE_CONFIG = AMEE::Config.setup
15
- end
16
-
17
- # Add AMEE extensions into ActiveRecord::Base
18
- ActiveRecord::Base.class_eval { include AMEE::Rails } if Object.const_defined?("ActiveRecord")
@@ -1,13 +0,0 @@
1
- defaults: &defaults
2
- server: stage.amee.com
3
- username: joe_shmoe
4
- password: top_sekrit123
5
-
6
- development:
7
- <<: *defaults
8
-
9
- test:
10
- <<: *defaults
11
-
12
- production:
13
- <<: *defaults
@@ -1,46 +0,0 @@
1
- # Copyright (C) 2008-2011 AMEE UK Ltd. - http://www.amee.com
2
- # Released as Open Source Software under the BSD 3-Clause license. See LICENSE.txt for details.
3
- require 'spec_helper.rb'
4
-
5
- describe AMEE::Config do
6
-
7
- # make sure environment variables are clear for each test
8
- before(:each) do
9
- ENV['AMEE_SERVER'] = nil
10
- ENV['AMEE_USERNAME'] = nil
11
- ENV['AMEE_PASSWORD'] = nil
12
- end
13
-
14
- context "loading config details from the environment"
15
-
16
- it "should let us use ENV variables so we can use heroku" do
17
- # fake the ENV variables setting
18
- ENV['AMEE_SERVER'] = "stage.amee.com"
19
- ENV['AMEE_USERNAME'] = "joe_shmoe"
20
- ENV['AMEE_PASSWORD'] = "top_sekrit123"
21
-
22
- amee_config = AMEE::Config.setup()
23
-
24
- amee_config[:username].should eq "joe_shmoe"
25
- amee_config[:server].should eq "stage.amee.com"
26
- amee_config[:password].should eq "top_sekrit123"
27
-
28
- end
29
-
30
- context "loading config details from a yaml file" do
31
-
32
- it "so we don't rely on heroku ALL the time" do
33
-
34
- config_path = File.dirname(__FILE__)+'/fixtures/rails_config.yml'
35
-
36
- amee_config = AMEE::Config.setup(config_path, 'test')
37
-
38
- amee_config[:username].should eq "joe_shmoe"
39
- amee_config[:server].should eq "stage.amee.com"
40
- amee_config[:password].should eq "top_sekrit123"
41
-
42
- end
43
- end
44
-
45
-
46
- end