Class: Snowflake
- Inherits:
-
Object
- Object
- Snowflake
- Defined in:
- lib/snowflake.rb
Instance Attribute Summary collapse
-
#ci_field ⇒ Object
Returns the value of attribute ci_field.
-
#endpoint ⇒ Object
Returns the value of attribute endpoint.
-
#hostname ⇒ Object
Returns the value of attribute hostname.
-
#password ⇒ Object
Returns the value of attribute password.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
- #debug(value = false) ⇒ Object
- #get(params = {}) ⇒ Object
-
#initialize(params = {}) ⇒ Snowflake
constructor
A new instance of Snowflake.
Constructor Details
#initialize(params = {}) ⇒ Snowflake
Returns a new instance of Snowflake.
4 5 6 7 8 |
# File 'lib/snowflake.rb', line 4 def initialize(params = {}) @user = params.fetch(:user) @endpoint = params.fetch(:endpoint) @password = params.fetch(:password) end |
Instance Attribute Details
#ci_field ⇒ Object
Returns the value of attribute ci_field.
2 3 4 |
# File 'lib/snowflake.rb', line 2 def ci_field @ci_field end |
#endpoint ⇒ Object
Returns the value of attribute endpoint.
2 3 4 |
# File 'lib/snowflake.rb', line 2 def endpoint @endpoint end |
#hostname ⇒ Object
Returns the value of attribute hostname.
2 3 4 |
# File 'lib/snowflake.rb', line 2 def hostname @hostname end |
#password ⇒ Object
Returns the value of attribute password.
2 3 4 |
# File 'lib/snowflake.rb', line 2 def password @password end |
#user ⇒ Object
Returns the value of attribute user.
2 3 4 |
# File 'lib/snowflake.rb', line 2 def user @user end |
Instance Method Details
#debug(value = false) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/snowflake.rb', line 10 def debug(value = false) Savon.configure do |config| config.log = value HTTPI.log = value end end |
#get(params = {}) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/snowflake.rb', line 17 def get(params = {}) hostname = params.fetch(:hostname) ci_field = params.fetch(:ci_field) debug(false) instance = Savon::client do wsdl.document = endpoint http.auth.basic user, password end response = instance.request(:get_records) do soap.body = { :name => hostname } end hash = response.to_hash hash.each_pair do |k, v| @answer = v[:get_records_result][ci_field.to_sym] end @answer.downcase end |