opensrs-email 0.0.1 → 0.0.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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MWJmMjU4NDA2N2UzOThiNmJjNWJjY2MyMjAwMDQ3YzAyMTA3NWY5OA==
4
+ MTMzMzFhNDY5YTAxOGU1ZWQ0YjkyMmRhNDQzZmExZjViMDEyNWJkNA==
5
5
  data.tar.gz: !binary |-
6
- MmJjYzFjODk1Y2QxZTQ0YjIwYWMyYjljMmY0NDBmMmU4YjFiYjI0ZA==
6
+ YmFlYmI0YjBhNTM5OTBkMTcwYTlkNTZhNGFjYTg1ZDllZGU2NWIyZA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NGEzNzEyZTIyZjIyMWFkZDdmOGQ2MGU2OGZjNDA3NDU3ZGNkMDcxOTJmODRk
10
- YTQyYTFjN2Q3NmI5YWMxOTcyNTRmNmM2ZjZkYTBjNzQwODM4NjgyZTcyNGFh
11
- MjAwMTg5MzM4MTcxM2FiMjA4ZTJjMTk0NjdhOTZiYTA1ZGMzZTE=
9
+ NzBlOGM1MmY3OTRlMzRlODRkZGQzYTM5NWFkNjFkMzQ4ZmU2NzM0NzUzNGUw
10
+ MDFlMGQwOWFjZjkwNGRiMzUwMWQ0OTJmM2EwMWY3MDk4MDk5NTFlNmE1ZDJj
11
+ M2JiN2Q0NjllMTFmMmM2ZmRhZTg1YzIzYjgxOWQxYjg2NmViZDE=
12
12
  data.tar.gz: !binary |-
13
- OTFiMzViM2IwYWE0ZDRiMGRiYWUzMjVkOThhZjc3MGM5N2ZlMDFmYTJjNWJm
14
- YTI4NmQ0ZDdhZjcyZDRhZDJiMmZiZTExYzUyMjFlZmU5MmYwMGFhODMyN2Q0
15
- YmJkZjA4MjRkNGY1OTkyZTA5NzE0YTA0NjM5ZDQ0YTllYzhmMjc=
13
+ MWE2ZjU1MTJiZGIwYTAyYmJkYzhmMjFkZmNjMjJjODg0YmJmNmU5NjIzY2Mz
14
+ ODlkMDlmMGY0OGI4NTY3MTI1NDkxYTQ1ODMzYzllYjEyYjJhYmQwNDA2NWU2
15
+ MWUwZWEzYTY4MjAyMGE4ZDFhNDFjZTNmMmZlYjNiMmJlYTQzZDc=
@@ -25,8 +25,51 @@ module Opensrs
25
25
  :get_domain_allow_list,
26
26
  :get_domain_block_list
27
27
  ]
28
- def create_domain(domain)
29
- call(:create_domain, {:domain => domain})
28
+
29
+ DOMAIN_REQUIRED_ARGS = {
30
+ :create_domain => [:domain],
31
+ :create_domain_alias => [:domain, :alias],
32
+ :delete_domain => [:domain],
33
+ :delete_domain_alias => [:alias],
34
+ :create_domain_welcome_email => [:domain, :welcome_text, :welcome_subject, :from_name, :from_address, :charset, :mime_type],
35
+ :get_company_domains => [],
36
+ :delete_domain_welcome_email => [:domain],
37
+ :get_domain => [:domain],
38
+ :get_domain_brand => [:domain],
39
+ :change_domain => [:domain],
40
+ :set_domain_admin => [:domain, :mailbox],
41
+ :set_domain_brand => [:domain],
42
+ :set_domain_catch_all_mailbox => [:domain, :state, :mailbox],
43
+ :set_domain_disabled_status => [:domain, :disabled],
44
+ :get_num_domain_mailboxes => [:domain],
45
+ :get_domain_mailboxes => [:domain],
46
+ :get_domain_mailbox_limits => [:domain],
47
+ :set_domain_mailbox_limits => [:domain],
48
+ :set_domain_allow_list => [:domain, :list],
49
+ :set_domain_block_list => [:domain, :list],
50
+ :get_domain_allow_list => [:domain],
51
+ :get_domain_block_lis => [:domain]
52
+ }
53
+
54
+ DOMAIN_COMMANDS.each do |method_name|
55
+ define_method("#{method_name}") { |*args|
56
+ has_opt = args[-1].is_a? Hash
57
+ if has_opt
58
+ positional_args = args[0...-1]
59
+ optional_args = args[-1]
60
+ else
61
+ positional_args = args
62
+ optional_args = {}
63
+ end
64
+ required_args = DOMAIN_REQUIRED_ARGS[method_name]
65
+ if required_args.length != positional_args.length
66
+ raise "Argument Error for method #{method_name}: required arguments are: #{required_args}, provided arguments are: #{positional_args}"
67
+ else
68
+ params = Hash[required_args.zip(positional_args)]
69
+ params = params.merge(optional_args)
70
+ call(method_name, params)
71
+ end
72
+ }
30
73
  end
31
74
  end
32
75
  end
@@ -6,7 +6,6 @@ module Opensrs
6
6
  :get_alternate_mailbox_names,
7
7
  :create_mailbox,
8
8
  :set_mail_admin,
9
- :set_mail_admin,
10
9
  :change_mailbox,
11
10
  :create_alias_mailbox,
12
11
  :rename_mailbox,
@@ -46,13 +45,70 @@ module Opensrs
46
45
  :change_mailbox_forward_only,
47
46
  :delete_mailbox_forward_only,
48
47
  ]
49
-
50
- def create_mailbox_forward_only(mailbox, domain, forward_email, workgroup)
51
- call(:create_mailbox_forward_only, {:mailbox => mailbox, :domain => domain, :forward_email => forward_email, :workgroup => workgroup})
52
- end
53
48
 
54
- def delete_mailbox_forward_only(mailbox, domain)
55
- call(:delete_mailbox_forward_only, {:mailbox => mailbox, :domain => domain})
49
+ MAIL_REQUIRED_ARGS = {
50
+ :get_mailbox_availability => [:domain, :mailbox_list],
51
+ :get_alternate_mailbox_names => [:mailbox_list],
52
+ :create_mailbox => [:mailbox, :password, :workgroup, :domain],
53
+ :set_mail_admin => [:domain, :mailbox],
54
+ :change_mailbox => [:mailbox, :domain],
55
+ :create_alias_mailbox => [:mailbox, :domain, :alias_mailbox],
56
+ :rename_mailbox => [:domain, :old_mailbox, :new_mailbox],
57
+ :set_mailbox_allow_list => [:mailbox, :domain, :list],
58
+ :set_mailbox_block_list => [:mailbox, :domain, :list],
59
+ :get_mailbox_allow_list => [:mailbox, :domain],
60
+ :get_mailbox_block_list => [:mailbox, :domain],
61
+ :verify_password => [:domain, :mailbox, :password],
62
+ :get_admin => [:domain, :mailbox],
63
+ :get_mailbox => [:domain, :mailbox],
64
+ :get_mailbox_any => [:domain, :mailbox],
65
+ :get_mailbox_services => [:mailbox, :domain],
66
+ :set_mailbox_services => [:mailbox, :domain],
67
+ :get_mailbox_quota => [:mailbox, :domain],
68
+ :set_mailbox_quota => [:mailbox, :domain, :quota],
69
+ :delete_mailbox => [:mailbox, :domain],
70
+ :delete_mailbox_any => [:domain, :mailbox],
71
+ :set_mailbox_autorespond => [:mailbox, :domain],
72
+ :get_mailbox_autorespond => [:mailbox, :domain],
73
+ :set_mailbox_forward => [:mailbox, :domain],
74
+ :get_mailbox_forward => [:mailbox, :domain],
75
+ :show_available_offerings => [:domain, :mailbox],
76
+ :show_enabled_offerings => [:domain, :mailbox],
77
+ :disable_offering => [:mailbox_offering_id],
78
+ :enable_offering => [:domain, :mailbox, :offering_id],
79
+ :set_mailbox_suspension => [:mailbox, :domain],
80
+ :get_mailbox_suspension => [:mailbox, :domain],
81
+ :set_mailbox_status => [:mailbox, :domain],
82
+ :get_mailbox_status => [:mailbox, :domain],
83
+ :create_group_alias_mailbox => [:group_alias_mailbox, :workgroup, :domain, :alias_to_email_cdl],
84
+ :get_group_alias_mailbox => [:domain, :group_alias_mailbox],
85
+ :change_group_alias_mailbox => [:domain, :group_alias_mailbox],
86
+ :delete_group_alias_mailbox => [:group_alias_mailbox, :domain],
87
+ :create_mailbox_forward_only => [:mailbox, :workgroup, :domain, :forward_email],
88
+ :get_mailbox_forward_only => [:domain, :mailbox],
89
+ :change_mailbox_forward_only => [:domain, :mailbox],
90
+ :delete_mailbox_forward_only => [:mailbox, :domain]
91
+ }
92
+
93
+ MAIL_COMMANDS.each do |method_name|
94
+ define_method("#{method_name}") { |*args|
95
+ has_opt = args[-1].is_a? Hash
96
+ if has_opt
97
+ positional_args = args[0...-1]
98
+ optional_args = args[-1]
99
+ else
100
+ positional_args = args
101
+ optional_args = {}
102
+ end
103
+ required_args = MAIL_REQUIRED_ARGS[method_name]
104
+ if required_args.length != positional_args.length
105
+ raise "Argument Error for method #{method_name}: required arguments are: #{required_args}, provided arguments are: #{positional_args}"
106
+ else
107
+ params = Hash[required_args.zip(positional_args)]
108
+ params = params.merge(optional_args)
109
+ call(method_name, params)
110
+ end
111
+ }
56
112
  end
57
113
  end
58
114
  end
@@ -1,5 +1,5 @@
1
1
  module Opensrs
2
2
  module Email
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
@@ -1,12 +1,40 @@
1
1
  module Opensrs
2
2
  module Email
3
3
  module Workgroup
4
- WORKGROUP_COMMAND = [
4
+ WORKGROUP_COMMANDS = [
5
5
  :create_workgroup,
6
6
  :get_domain_workgroups,
7
7
  :delete_workgroup,
8
8
  :set_workgroup_admin
9
9
  ]
10
+
11
+ WORKGROUP_REQUIRED_ARGS = {
12
+ :create_workgroup => [:workgroup, :domain],
13
+ :get_domain_workgroups => [:domain],
14
+ :delete_workgroup => [:workgroup, :domain],
15
+ :set_workgroup_admi => [:domain, :mailbox]
16
+ }
17
+
18
+ WORKGROUP_COMMANDS.each do |method_name|
19
+ define_method("#{method_name}") { |*args|
20
+ has_opt = args[-1].is_a? Hash
21
+ if has_opt
22
+ positional_args = args[0...-1]
23
+ optional_args = args[-1]
24
+ else
25
+ positional_args = args
26
+ optional_args = {}
27
+ end
28
+ required_args = WORKGROUP_REQUIRED_ARGS[method_name]
29
+ if required_args.length != positional_args.length
30
+ raise "Argument Error for method #{method_name}: required arguments are: #{required_args}, provided arguments are: #{positional_args}"
31
+ else
32
+ params = Hash[required_args.zip(positional_args)]
33
+ params = params.merge(optional_args)
34
+ call(method_name, params)
35
+ end
36
+ }
37
+ end
10
38
  end
11
39
  end
12
40
  end
@@ -55,4 +55,3 @@ describe Opensrs::Email::Gateway do
55
55
  end
56
56
  end
57
57
  end
58
-
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opensrs-email
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Li Zhenchao
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-24 00:00:00.000000000 Z
11
+ date: 2014-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler