Module: RegApi2
- Extended by:
- Action
- Defined in:
- lib/reg_api2.rb,
lib/reg_api2/bill.rb,
lib/reg_api2/impl.rb,
lib/reg_api2/shop.rb,
lib/reg_api2/user.rb,
lib/reg_api2/zone.rb,
lib/reg_api2/action.rb,
lib/reg_api2/common.rb,
lib/reg_api2/domain.rb,
lib/reg_api2/folder.rb,
lib/reg_api2/builder.rb,
lib/reg_api2/console.rb,
lib/reg_api2/hosting.rb,
lib/reg_api2/service.rb,
lib/reg_api2/version.rb,
lib/reg_api2/sym_hash.rb,
lib/reg_api2/api_error.rb,
lib/reg_api2/net_error.rb,
lib/reg_api2/entity/user.rb,
lib/reg_api2/contract_error.rb,
lib/reg_api2/result_contract.rb,
lib/reg_api2/request_contract.rb,
lib/reg_api2/entity/entity_base.rb
Overview
Provides r/w settings for API connection:
- RegApi2.username - Your user name.
test
by default. - RegApi2.password - Your password.
test
by default. - RegApi2.io_encoding - Input/ouput encoding.
utf-8
by default. - RegApi2.lang - Language of API answers.
en
by default. - RegApi2.ca_cert_path, RegApi2.pem and RegApi2.pem_password - optional certification properties. nils by default.
Provides shortcuts for API categories:
- RegApi2.common API category implemented as Common methods.
- RegApi2.domain API category implemented as Domain methods.
- RegApi2.user API category implemented as User methods.
- RegApi2.service API category implemented as Service methods.
- RegApi2.bill API category implemented as Bill methods.
- RegApi2.folder API category implemented as Folder methods.
- RegApi2.zone API category implemented as Zone methods.
- RegApi2.hosting API category implemented as Hosting methods.
- RegApi2.shop API category implemented as Shop methods.
Provides dump hooks:
- RegApi2.dump_requests to dump outgoing API request forms.
- RegApi2.dump_responses to dump incoming API responses.
Please read README for API overview.
Defined Under Namespace
Modules: Action, Bill, Builder, Common, Domain, Entity, Folder, Hosting, Service, Shop, User, Zone Classes: ApiError, Console, ContractError, NetError, RequestContract, ResultContract, SymHash
Constant Summary collapse
- VERSION =
Gem version.
"0.0.16".freeze
Constants included from Action
Action::API_URI, Action::DEFAULT_IO_ENCODING, Action::DEFAULT_LANG, Action::DEFAULT_PASSWORD, Action::DEFAULT_USERNAME
Class Attribute Summary collapse
-
.ca_cert_path ⇒ String
Path to certification authority certificate (nil by default).
-
.dump_requests_to ⇒ String, ...
Where to dump outgoing API request (nil by default).
-
.dump_responses_to ⇒ String, ...
Where to dump incoming API response (nil by default).
-
.io_encoding ⇒ String
IO encoding (
utf-8
by default). -
.lang ⇒ String
Language (
en
by default). -
.password ⇒ String
Password (
test
by default). -
.pem ⇒ String
X.509 certificate (nil by default).
-
.pem_password ⇒ String
X.509 certificate password (nil by default).
-
.username ⇒ String
User name (
test
by default).
Class Method Summary collapse
-
.bill ⇒ Module
Shortcut for Bill methods.
-
.common ⇒ Module
Shortcut for Common methods.
-
.domain ⇒ Module
Shortcut for Domain methods.
-
.dump_requests(to = nil, &code_block) {|path, form| ... } ⇒ NilClass
Dumps outgoing API requests to given
to
or code block. -
.dump_responses(to = nil, &code_block) {|json| ... } ⇒ NilClass
Dumps incoming API responses to given
to
or code block. -
.folder ⇒ Module
Shortcut for Folder methods.
-
.form_to_be_sent(path, form) ⇒ Object
Placeholder to inspect sent form.
-
.got_response(response) ⇒ Object
Placeholder to inspect got response.
-
.hosting ⇒ Module
Shortcut for Hosting methods.
-
.service ⇒ Module
Shortcut for Service methods.
-
.shop ⇒ Module
Shortcut for Shop methods.
-
.user ⇒ Module
Shortcut for User methods.
-
.zone ⇒ Module
Shortcut for Zone methods.
Methods included from Action
clear_http, create_http, get_form_data, handle_response, http, make_action
Class Attribute Details
.ca_cert_path ⇒ String
Returns Path to certification authority certificate (nil by default).
134 135 136 |
# File 'lib/reg_api2.rb', line 134 def ca_cert_path @ca_cert_path end |
.dump_requests_to ⇒ String, ...
Returns Where to dump outgoing API request (nil by default).
Value | Dump to |
---|---|
nil | Nothing |
:stdout, "stdout" | $stdout |
:stderr, "stderr" | $stderr |
lambda | Calls this lambda with requested path and form hash |
37 38 39 |
# File 'lib/reg_api2/impl.rb', line 37 def dump_requests_to @dump_requests_to end |
.dump_responses_to ⇒ String, ...
Returns Where to dump incoming API response (nil by default).
Value | Dump to |
---|---|
nil | Nothing |
:stdout, "stdout" | $stdout |
:stderr, "stderr" | $stderr |
lambda | Calls this lambda with incoming parsed JSON data |
47 48 49 |
# File 'lib/reg_api2/impl.rb', line 47 def dump_responses_to @dump_responses_to end |
.io_encoding ⇒ String
Returns IO encoding (utf-8
by default).
128 129 130 |
# File 'lib/reg_api2.rb', line 128 def io_encoding @io_encoding end |
.lang ⇒ String
Returns Language (en
by default).
131 132 133 |
# File 'lib/reg_api2.rb', line 131 def lang @lang end |
.password ⇒ String
Returns Password (test
by default).
125 126 127 |
# File 'lib/reg_api2.rb', line 125 def password @password end |
.pem ⇒ String
Returns X.509 certificate (nil by default).
137 138 139 |
# File 'lib/reg_api2.rb', line 137 def pem @pem end |
.pem_password ⇒ String
Returns X.509 certificate password (nil by default).
140 141 142 |
# File 'lib/reg_api2.rb', line 140 def pem_password @pem_password end |
.username ⇒ String
Returns User name (test
by default).
122 123 124 |
# File 'lib/reg_api2.rb', line 122 def username @username end |
Class Method Details
.bill ⇒ Module
Shortcut for Bill methods.
92 |
# File 'lib/reg_api2.rb', line 92 def bill; RegApi2::Bill; end |
.common ⇒ Module
Shortcut for Common methods
68 |
# File 'lib/reg_api2.rb', line 68 def common; RegApi2::Common; end |
.domain ⇒ Module
Shortcut for Domain methods.
74 |
# File 'lib/reg_api2.rb', line 74 def domain; RegApi2::Domain; end |
.dump_requests(to = nil, &code_block) {|path, form| ... } ⇒ NilClass
Dumps outgoing API requests to given to
or code block.
66 67 68 69 70 71 72 |
# File 'lib/reg_api2/impl.rb', line 66 def dump_requests(to = nil, &code_block) if to.nil? && block_given? to = code_block end self.dump_requests_to = to nil end |
.dump_responses(to = nil, &code_block) {|json| ... } ⇒ NilClass
Dumps incoming API responses to given to
or code block.
89 90 91 92 93 94 95 |
# File 'lib/reg_api2/impl.rb', line 89 def dump_responses(to = nil, &code_block) if to.nil? && block_given? to = code_block end self.dump_responses_to = to nil end |
.folder ⇒ Module
Shortcut for Folder methods.
98 |
# File 'lib/reg_api2.rb', line 98 def folder; RegApi2::Folder; end |
.form_to_be_sent(path, form) ⇒ Object
Placeholder to inspect sent form
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/reg_api2/impl.rb', line 101 def form_to_be_sent(path, form) case dump_requests_to when :stderr, "stderr" $stderr.puts "RegApi2.Request:\n#{path}\n#{form}" when :stdout, "stdout" $stdout.puts "RegApi2.Request:\n#{path}\n#{form}" when Proc dump_requests_to.call(path, form) when nil ; else raise ArgumentError.new( "Bad dump_requests_to field: #{dump_requests_to.inspect}" ) end nil end |
.got_response(response) ⇒ Object
Placeholder to inspect got response.
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/reg_api2/impl.rb', line 120 def got_response(response) case dump_responses_to when :stderr, "stderr" $stderr.puts "RegApi2.Response:\n#{response}" when :stdout, "stdout" $stdout.puts "RegApi2.Response:\n#{response}" when Proc dump_responses_to.call(response) when nil ; else raise ArgumentError.new( "Bad dump_responses_to field: #{dump_responses_to.inspect}" ) end nil end |
.hosting ⇒ Module
Shortcut for Hosting methods.
110 |
# File 'lib/reg_api2.rb', line 110 def hosting; RegApi2::Hosting; end |
.service ⇒ Module
Shortcut for Service methods.
86 |
# File 'lib/reg_api2.rb', line 86 def service; RegApi2::Service; end |
.shop ⇒ Module
Shortcut for Shop methods.
116 |
# File 'lib/reg_api2.rb', line 116 def shop; RegApi2::Shop; end |