gateway_signup 0.1.1 → 0.1.2

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.
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'gateway_signup'
3
- s.version = '0.1.1'
3
+ s.version = '0.1.2'
4
4
  s.date = '2014-01-29'
5
5
  s.summary = "Spreedly Gateway Registration Field Lookup"
6
6
  s.description = "Small library for reading a config and returning the fields required to register a specific gateway with Spreedly"
@@ -18,10 +18,23 @@ module GatewaySignup
18
18
  @gw_data.keys
19
19
  end
20
20
 
21
+ def countries
22
+ @count=[]
23
+ @gw_data.each do |k, v|
24
+ @count = @count + v[:countries]
25
+ end
26
+ @count = @count.uniq.sort
27
+ us = @count.index('US')
28
+ @count.delete_at(us)
29
+ @count = @count.unshift('US')
30
+ @count.to_json.html_safe
31
+ end
32
+
21
33
  def gateway_list
22
- @list = {}
34
+ @list = hash_tree
23
35
  @gw_data.each do |k, v|
24
- @list[k] = v[:display_name]
36
+ @list[k]["display"] = v[:display_name]
37
+ @list[k]["countries"] = v[:countries]
25
38
  end
26
39
  @list.to_json.html_safe
27
40
  end
@@ -33,6 +46,13 @@ module GatewaySignup
33
46
  def for_country(country)
34
47
  gateways.select { |gw| @gw_data[gw][:countries].include? country }
35
48
  end
49
+
50
+ def hash_tree
51
+ Hash.new do |hash, key|
52
+ hash[key] = hash_tree
53
+ end
54
+ end
55
+
36
56
  end
37
57
  end
38
58
  end
@@ -16,6 +16,10 @@ module GatewaySignup
16
16
  @config.gateway_list
17
17
  end
18
18
 
19
+ def countries
20
+ @config.countries
21
+ end
22
+
19
23
  def fields_for(gateway)
20
24
  @config.fields_for gateway
21
25
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gateway_signup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -68,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
68
68
  version: '0'
69
69
  requirements: []
70
70
  rubyforge_project:
71
- rubygems_version: 1.8.23
71
+ rubygems_version: 1.8.25
72
72
  signing_key:
73
73
  specification_version: 3
74
74
  summary: Spreedly Gateway Registration Field Lookup
@@ -76,3 +76,4 @@ test_files:
76
76
  - spec/spec_helper.rb
77
77
  - spec/support/gateways.yml
78
78
  - spec/support/gw.yml
79
+ has_rdoc: