Sha256: cda1bdaebab3f9ab0b7f259f0323d0dc9d19b541faa3e6a038f375291dc89faa
Contents?: true
Size: 1.13 KB
Versions: 4
Compression:
Stored size: 1.13 KB
Contents
module MWS class Connection DEFAULT_HOST = "mws.amazonservices.com" def initialize(options={}) attrs.each do |a| self.class.send(:attr_reader, a) instance_variable_set("@#{a}", options[a]) end @host ||= DEFAULT_HOST attrs.each { |a| raise MissingConnectionOptions, ":#{a} is required" if instance_variable_get("@#{a}").nil?} end def public_attrs [:aws_access_key_id, :seller_id, :marketplace_id, :host] end def private_attrs [:secret_access_key] end def attrs public_attrs + private_attrs end # an attempt to hide sensitive login credentials in logs, just being paranoid def inspect "#<MWS::Connection:#{object_id}>" end def server_time self.class.server_time @host end def to_hash hsh = {} attrs.each { |a| hsh[a] = instance_variable_get("@#{a}")} hsh end # No connection needs to be initialized for this call def self.server_time(host=DEFAULT_HOST) response = HTTParty.get("https://#{host}") Time.parse(response['PingResponse']['Timestamp']['timestamp']) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
ruby-mws-0.1 | lib/ruby-mws/connection.rb |
ruby-mws-0.0.4 | lib/ruby-mws/connection.rb |
ruby-mws-0.0.3 | lib/ruby-mws/connection.rb |
ruby-mws-0.0.2 | lib/ruby-mws/connection.rb |