lib/netki/netki.rb in netki-0.0.3 vs lib/netki/netki.rb in netki-0.0.4

- old
+ new

@@ -115,11 +115,11 @@ # :section: Currency Address Operations # Set the address or URI for the given currency for this wallet name def set_currency_address(currency, address) - @wallets[currency][:address] = address + @wallets[currency] = { address: address } end # Remove a used currency from this wallet name def remove_currency(currency) @wallets.delete(currency) if @wallets.has_key? currency @@ -154,22 +154,24 @@ wallets: wallet_data, external_id: @external_id || 'null' } wn_api_data = {} - wn_api_data['wallet_names'] = [wn_data,] + wn_api_data['wallet_names'] = [wn_data] if @id wn_data['id'] = @id response = Netki.process_request(@api_key, @partner_id, "#{@api_url}/v1/partner/walletname", 'PUT', JSON.dump(wn_api_data)) else response = Netki.process_request(@api_key, @partner_id, "#{@api_url}/v1/partner/walletname", 'POST', JSON.dump(wn_api_data)) end unless @id response['wallet_names'].each do |wn| - if response['success'] && wn['domain_name'] == @domain_name && wn['name'] == @name + if (response['success'] && + wn['domain_name'] == @domain_name && + wn['name'] == @name) @id = wn['id'] else raise 'Success, but invalid response received!' end end @@ -180,11 +182,11 @@ # Delete this WalletName object from the remote service def delete raise 'Unable to Delete Object that Does Not Exist Remotely' unless @id wn_api_data = { - wallet_names: [{domain_name: @domain_name, id: @id}] + wallet_names: [ { domain_name: @domain_name, id: @id } ] } Netki.process_request(@api_key, @partner_id, "#{@api_url}/v1/partner/walletname", 'DELETE', JSON.dump(wn_api_data)) end end @@ -264,15 +266,14 @@ # If domain_name is omitted status is returned for all available domain resources. # # Returns a list of Hashes, each containing current status for each domain # def get_domain_status(domain_name=nil) - uri="#{@api_url}/v1/partner/domain" uri << "/#{domain_name}" unless domain_name.nil? response = Netki.process_request(@api_key, @partner_id, uri, method='GET') - response['domains'] + response['domains'] || response end ## # Get DNSSEC Status of Domain # * domain_name -> (Required) Name of domain to get DNSSEC status for