moreapp-api 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/moreapp_api/customer.rb +1 -1
- data/lib/moreapp_api/folder.rb +5 -5
- data/lib/moreapp_api/form.rb +20 -13
- data/moreapp-api.gemspec +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2eefddaffa193aa310b743e9441cee878eac0d81
|
4
|
+
data.tar.gz: 02f4b197ab058491f3d364d6fbd336e22872a73a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2b59ad510afaca45f671ac1fb95f28cdbd21788c36cf5fc7830c7f66e5b737d287466d8867b723c7ffc54167aba28bf52c4d79d42b1c100343cd70e288804c8
|
7
|
+
data.tar.gz: d66674f778576fdffeee82ddf872316879e1bccc5f39f7ad5d5a760025a4e5ec6a445b744d7682a985f6709b00891787ca8ad5b6623cbd614ad28f0a983c73b6
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.4
|
data/lib/moreapp_api/customer.rb
CHANGED
@@ -14,7 +14,7 @@ class MoreappAPI
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def folders
|
17
|
-
response = @moreapp_api.request(:get, "/api/v1.0/forms/customer/#{self.id}/folders")
|
17
|
+
response = @moreapp_api.request(:get, "/api/v1.0/forms/customer/#{self.id}/folders?expand=forms")
|
18
18
|
|
19
19
|
folders = JSON.parse(response.body)
|
20
20
|
folders.map{|data| MoreappAPI::Folder.new(self, data)}
|
data/lib/moreapp_api/folder.rb
CHANGED
@@ -8,17 +8,17 @@ class MoreappAPI
|
|
8
8
|
def initialize(customer, data)
|
9
9
|
@moreapp_api = customer.moreapp_api
|
10
10
|
@customer = customer
|
11
|
-
@id = data["applicationId"]
|
12
|
-
@name = data["name"]
|
11
|
+
@id = data["meta"]["applicationId"]
|
12
|
+
@name = data["meta"]["name"]
|
13
13
|
@form_ids = data["forms"]
|
14
14
|
@raw_data = data
|
15
15
|
end
|
16
16
|
|
17
17
|
def forms
|
18
|
-
@form_ids.map do |
|
19
|
-
MoreappAPI::Form.
|
18
|
+
@form_ids.map do |form_data|
|
19
|
+
MoreappAPI::Form.create_from_folder(self, form_data)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
23
|
end
|
24
|
-
end
|
24
|
+
end
|
data/lib/moreapp_api/form.rb
CHANGED
@@ -7,7 +7,7 @@ class MoreappAPI
|
|
7
7
|
attr_accessor :id, :name, :raw_data
|
8
8
|
|
9
9
|
|
10
|
-
def initialize(moreapp_api, customer_or_id,
|
10
|
+
def initialize(moreapp_api, customer_or_id, form_id, form_name = "", raw_data = nil)
|
11
11
|
@moreapp_api = moreapp_api
|
12
12
|
|
13
13
|
if customer_or_id.is_a?(MoreappAPI::Customer)
|
@@ -16,20 +16,31 @@ class MoreappAPI
|
|
16
16
|
else
|
17
17
|
@customer_id = customer_or_id
|
18
18
|
end
|
19
|
-
if folder_or_id.is_a?(MoreappAPI::Folder)
|
20
|
-
@folder = folder_or_id
|
21
|
-
@folder_id = @folder.id
|
22
|
-
else
|
23
|
-
@folder_id = folder_or_id
|
24
|
-
end
|
25
19
|
@id = form_id
|
26
20
|
@name = form_name
|
21
|
+
@raw_data = raw_data
|
27
22
|
end
|
28
23
|
|
29
24
|
|
30
|
-
def self.
|
25
|
+
def self.create_from_folder(folder, long_id_or_hash)
|
31
26
|
customer = folder.customer
|
32
|
-
|
27
|
+
if long_id_or_hash.is_a?(Hash)
|
28
|
+
form_id = long_id_or_hash["id"]
|
29
|
+
form_name = long_id_or_hash["meta"]["name"]
|
30
|
+
raw_data = long_id_or_hash
|
31
|
+
else
|
32
|
+
form_id = long_id[0..31]
|
33
|
+
form_name = long_id[32..-1]
|
34
|
+
raw_data = nil
|
35
|
+
end
|
36
|
+
MoreappAPI::Form.new(customer.moreapp_api, customer, form_id, form_name, raw_data)
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
def self.create_from_id(customer, id)
|
41
|
+
response = customer.moreapp_api.request(:get, "/api/v1.0/forms/customer/#{customer.id}/forms/#{id}")
|
42
|
+
form_data = JSON.parse(response.body)
|
43
|
+
MoreappAPI::Form.new(customer.moreapp_api, customer, nil, form_data["id"], form_data["meta"]["name"], form_data)
|
33
44
|
end
|
34
45
|
|
35
46
|
|
@@ -47,10 +58,6 @@ class MoreappAPI
|
|
47
58
|
end
|
48
59
|
|
49
60
|
|
50
|
-
def registrations(page=0, options={})
|
51
|
-
submissions page, options
|
52
|
-
end
|
53
|
-
|
54
61
|
|
55
62
|
def post_instruction(recipients, message, data, options={})
|
56
63
|
recipients = recipients.is_a?(String) ? [recipients] : recipients
|
data/moreapp-api.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: moreapp-api 0.0.
|
5
|
+
# stub: moreapp-api 0.0.4 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "moreapp-api".freeze
|
9
|
-
s.version = "0.0.
|
9
|
+
s.version = "0.0.4"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|