isurvey 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZDNmZjAwZDllYjEzZjJlMTM2MDIzNWZhMWU5MDdlMzM2NTAzNmMxOA==
4
+ OTViOTQwNTM2ZWMyMDE2MzRlMzJiYTAyMGE5MDQzYzQ0NGIwM2U2Mw==
5
5
  data.tar.gz: !binary |-
6
- ZGNmMzA4NzkwNDJhY2NiOTEwMjIyYTFlOGY5ZTc3MzkxOTk2ODlhYw==
6
+ MjIzMTdkMDc2ZTZmYjRkNGViMmJlMmZlNDFjNGZjY2ZhOWEyODhjNw==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- YWNiYWM4NjA4ZjY1ZTc2NGM2YzdmNjIwMTEyZmI0NTQxNTFhYzg0NDdkYWVm
10
- MmJjMzZjYmE4NWMwNzY4Y2QwY2EyY2QxMjY4MjQzMTdhM2IxNDgxN2ZmYTJi
11
- ZTVmYTI5NmUxY2Y4MzBmOTRkNmFiOTg5MTI1MDQwODUwMGQxZDg=
9
+ MjAwMzAwNTY3YzQwMTNmZDA2YmE2YWJmNzZmYTBmMjUxNDJlYWIwOTdjM2Jl
10
+ Njg3N2E0YzNkN2JiMWI5NjBiMjNkOWVkM2ZkYjg3MmQ0MjFkZWRjYjhlY2U5
11
+ ZmU4OWRiZDE4OWVkNGI3YTNiNjAyNDkwODNiYWMwNWNmZWExZGI=
12
12
  data.tar.gz: !binary |-
13
- YWRjNDNkMjJjYTIzZWE1MWJiYjY4OTE1NGQ5MWZjZmRmNzc4NWQ2ZTE3ODhk
14
- YzQ2MDg5YjFmYmUxYTU5OWExNTRhMWNiZTYwNzhjOTMyNWQ1MDUyMDNlNGM1
15
- NzU4NmE3NjNkNzMyYmEzMGU3MmI0Zjg3MjAyNWYxZWYwN2YyMzM=
13
+ OTgyMDJlZmM3ZWQ4YmU3NjgwMWVjZTk5MGQxMTY0YThlZmFhZTVlZjNkMzE1
14
+ ODVhNzdhZGIzNjVmNjRmZmM5NWQwMTQzZTc2OWEyNGY2Y2RhNDFjNmE1NTEy
15
+ OWY0NTg1MjM2ZDA0YjBhYzc4MzBhNGM5ZDQxYTY4NDZjMWQ2YTQ=
data/.gitignore CHANGED
@@ -15,3 +15,4 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ creds.rb
data/README.md CHANGED
@@ -21,7 +21,7 @@ You must set up your company identifier and survey password. Perhaps in config/
21
21
  Isurvey::Credentials.company_identifier = [cp]
22
22
  Isurvey::Credentials.survey_password = [sp]
23
23
 
24
- Before being used, the API must be loaded. This can be done in your initialzer or in any other place you see fit.
24
+ Before being used, the API must be loaded. This can be done in your application controller or in any other place you see fit.
25
25
 
26
26
  Isurvey::API.load
27
27
 
@@ -41,22 +41,31 @@ All of the properties available through the iSurvey API are also available throu
41
41
 
42
42
  For questions, the available properties are:
43
43
 
44
- :screen_id, :question_number, :screen_id_next, :show_labels, :selectable_images, :screen_text, :screen_instructions, :theme_class_id, :screen_options, :answers, :questions
44
+ :screen_id, :question_number, :screen_id_next, :show_labels, :selectable_images, :screen_text, :screen_instructions, :theme_class_id, :screen_options, :answers
45
45
 
46
46
  For answers, the available properties are:
47
47
 
48
- :screen_id, :question_id, :answer_id, :result_answer, :response_date
48
+ :screen_id, :question_id, :answer_id, :result_answer, :response_date, :question
49
+
50
+ For results, the available properties are:
51
+
52
+ :screen_results, :result_id, :result_device_name, :is_demo_survey, :survey_id, :survey_version, :survey_start_date, :survey_end_date, :result_location_accuracy, :result_location_altitude, :result_location_latitude, :result_location_longitude, :result_device_guid, :result_location_status, :is_incomplete, :answers
49
53
 
50
54
  Any property can also be used to find on either questions or answers. For example:
51
55
 
52
56
  Isurvey::Question.find_by_screen_id(:id)
53
57
  Isurvey::Answer.find_by_question_id(:id)
58
+ Isurvey::Result.find_by_result_id(:id)
54
59
 
55
60
  You can query a question for its answers, or an answer for its question.
56
61
 
57
62
  Isurvey::Question.first.answers
58
63
  Isurvey::Answer.first.question
59
64
 
65
+ You can get answers from a result.
66
+
67
+ Isurvey::Result.first.answers
68
+
60
69
  You can also find answers by result id.
61
70
 
62
71
  Isurvey::Question.first.answers_by_result_id(:id)
data/lib/isurvey/api.rb CHANGED
@@ -3,6 +3,7 @@ module Isurvey
3
3
  def self.load
4
4
  questions
5
5
  answers
6
+ results
6
7
  end
7
8
 
8
9
  def self.questions
@@ -37,6 +38,16 @@ module Isurvey
37
38
  @answers
38
39
  end
39
40
 
41
+ def self.results
42
+ unless @results
43
+ @results = []
44
+ survey_results.each do |result|
45
+ @results << Result.new(hash: result)
46
+ end
47
+ end
48
+ @results
49
+ end
50
+
40
51
  private
41
52
  def self.survey
42
53
  SOAPClient.export_survey.body[:export_survey_response][:export_survey_result]
@@ -0,0 +1,10 @@
1
+ module Isurvey
2
+ class Result
3
+ include Base
4
+ extend Collector
5
+
6
+ def answers
7
+ Answer.by_result_id(self.result_id)
8
+ end
9
+ end
10
+ end
@@ -1,3 +1,3 @@
1
1
  module Isurvey
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
data/lib/isurvey.rb CHANGED
@@ -6,6 +6,7 @@ require_relative './isurvey/collector'
6
6
  require_relative './isurvey/api'
7
7
  require_relative './isurvey/question'
8
8
  require_relative './isurvey/answer'
9
+ require_relative './isurvey/result'
9
10
 
10
11
  module Isurvey
11
12
  class Credentials
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ describe Isurvey::Result do
4
+ before :all do
5
+ Isurvey::Credentials.company_identifier = ENV["ISURVEY_COMPANY_IDENTIFIER"]
6
+ Isurvey::Credentials.survey_password = ENV["ISURVEY_SURVEY_PASSWORD"]
7
+ Isurvey::API.load
8
+ end
9
+
10
+ it "should not be empty" do
11
+ Isurvey::Result.all.should_not be_blank
12
+ end
13
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1 @@
1
1
  require_relative '../lib/isurvey'
2
- require_relative '../lib/isurvey/base.rb'
3
- require_relative '../lib/isurvey/collector.rb'
4
- require_relative '../lib/isurvey/question.rb'
5
- require_relative '../lib/isurvey/answer.rb'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isurvey
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Nipper
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-09 00:00:00.000000000 Z
11
+ date: 2013-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: savon
@@ -99,11 +99,13 @@ files:
99
99
  - lib/isurvey/base.rb
100
100
  - lib/isurvey/collector.rb
101
101
  - lib/isurvey/question.rb
102
+ - lib/isurvey/result.rb
102
103
  - lib/isurvey/soap_client.rb
103
104
  - lib/isurvey/version.rb
104
105
  - spec/answer_spec.rb
105
106
  - spec/api_spec.rb
106
107
  - spec/question_spec.rb
108
+ - spec/result_spec.rb
107
109
  - spec/spec_helper.rb
108
110
  homepage: http://github.com/mnipper/isurvey
109
111
  licenses:
@@ -133,4 +135,5 @@ test_files:
133
135
  - spec/answer_spec.rb
134
136
  - spec/api_spec.rb
135
137
  - spec/question_spec.rb
138
+ - spec/result_spec.rb
136
139
  - spec/spec_helper.rb