Module: RegApi2
- Extended by:
- Action
- Defined in:
- lib/reg_api2.rb,
lib/reg_api2/user.rb,
lib/reg_api2/bill.rb,
lib/reg_api2/zone.rb,
lib/reg_api2/impl.rb,
lib/reg_api2/shop.rb,
lib/reg_api2/common.rb,
lib/reg_api2/folder.rb,
lib/reg_api2/domain.rb,
lib/reg_api2/action.rb,
lib/reg_api2/hosting.rb,
lib/reg_api2/version.rb,
lib/reg_api2/builder.rb,
lib/reg_api2/console.rb,
lib/reg_api2/service.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
- 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)
-
+ (String) ca_cert_path
Path to certification authority certificate (nil by default).
-
+ (String, ...) dump_requests_to
writeonly
Where to dump outgoing API request (nil by default).
-
+ (String, ...) dump_responses_to
writeonly
Where to dump incoming API response (nil by default).
-
+ (String) io_encoding
IO encoding (
utf-8
by default). -
+ (String) lang
Language (
en
by default). -
+ (String) password
Password (
test
by default). -
+ (String) pem
X.509 certificate (nil by default).
-
+ (String) pem_password
X.509 certificate password (nil by default).
-
+ (String) username
User name (
test
by default).
Class Method Summary (collapse)
-
+ (Module) bill
Shortcut for Bill methods.
-
+ (Module) common
Shortcut for Common methods.
-
+ (Module) domain
Shortcut for Domain methods.
-
+ (NilClass) dump_requests(to = nil, &code_block) {|path, form| ... }
Dumps outgoing API requests to given
to
or code block. -
+ (NilClass) dump_responses(to = nil, &code_block) {|json| ... }
Dumps incoming API responses to given
to
or code block. -
+ (Module) folder
Shortcut for Folder methods.
-
+ (Object) form_to_be_sent(path, form)
Placeholder to inspect sent form.
-
+ (Object) got_response(response)
Placeholder to inspect got response.
-
+ (Module) hosting
Shortcut for Hosting methods.
-
+ (Module) service
Shortcut for Service methods.
-
+ (Module) shop
Shortcut for Shop methods.
-
+ (Module) user
Shortcut for User methods.
-
+ (Module) zone
Shortcut for Zone methods.
Methods included from Action
clear_http, create_http, get_form_data, handle_response, http, make_action
Class Attribute Details
+ (String) ca_cert_path
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 |
+ (String, ...) dump_requests_to=(value)
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 |
+ (String, ...) dump_responses_to=(value)
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 |
+ (String) io_encoding
Returns IO encoding (utf-8
by default).
128 129 130 |
# File 'lib/reg_api2.rb', line 128 def io_encoding @io_encoding end |
+ (String) lang
Returns Language (en
by default).
131 132 133 |
# File 'lib/reg_api2.rb', line 131 def lang @lang end |
+ (String) password
Returns Password (test
by default).
125 126 127 |
# File 'lib/reg_api2.rb', line 125 def password @password end |
+ (String) pem
Returns X.509 certificate (nil by default).
137 138 139 |
# File 'lib/reg_api2.rb', line 137 def pem @pem end |
+ (String) pem_password
Returns X.509 certificate password (nil by default).
140 141 142 |
# File 'lib/reg_api2.rb', line 140 def pem_password @pem_password end |
+ (String) username
Returns User name (test
by default).
122 123 124 |
# File 'lib/reg_api2.rb', line 122 def username @username end |
Class Method Details
+ (Module) bill
Shortcut for Bill methods.
92 |
# File 'lib/reg_api2.rb', line 92 def bill; RegApi2::Bill; end |
+ (Module) common
Shortcut for Common methods
68 |
# File 'lib/reg_api2.rb', line 68 def common; RegApi2::Common; end |
+ (Module) domain
Shortcut for Domain methods.
74 |
# File 'lib/reg_api2.rb', line 74 def domain; RegApi2::Domain; end |
+ (NilClass) dump_requests(to = nil, &code_block) {|path, form| ... }
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 |
+ (NilClass) dump_responses(to = nil, &code_block) {|json| ... }
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 |
+ (Module) folder
Shortcut for Folder methods.
98 |
# File 'lib/reg_api2.rb', line 98 def folder; RegApi2::Folder; end |
+ (Object) form_to_be_sent(path, form)
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 |
+ (Object) got_response(response)
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 |
+ (Module) hosting
Shortcut for Hosting methods.
110 |
# File 'lib/reg_api2.rb', line 110 def hosting; RegApi2::Hosting; end |
+ (Module) service
Shortcut for Service methods.
86 |
# File 'lib/reg_api2.rb', line 86 def service; RegApi2::Service; end |
+ (Module) shop
Shortcut for Shop methods.
116 |
# File 'lib/reg_api2.rb', line 116 def shop; RegApi2::Shop; end |
+ (Module) user
Shortcut for User methods.
80 |
# File 'lib/reg_api2.rb', line 80 def user; RegApi2::User; end |
+ (Module) zone
Shortcut for Zone methods.
104 |
# File 'lib/reg_api2.rb', line 104 def zone; RegApi2::Zone; end |