reiformslive-ruby 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +20 -0
- data/Gemfile.lock +104 -0
- data/Guardfile +82 -0
- data/README.md +36 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/reiformslive/core_ext.rb +5 -0
- data/lib/reiformslive/credentials.rb +9 -0
- data/lib/reiformslive/form.rb +105 -0
- data/lib/reiformslive/session.rb +27 -0
- data/lib/reiformslive/template.rb +51 -0
- data/lib/reiformslive/user_template.rb +93 -0
- data/lib/reiformslive/version.rb +3 -0
- data/reiformslive-ruby.gemspec +28 -0
- metadata +129 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b67d79bcd634191ddb9f3e3e8a846dde46ef59bf
|
4
|
+
data.tar.gz: bdbc5a68ca3be8d81148c0ff7a67ec0237abee50
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6eb12b4aaeeafd3c38b0bae62789d731d281f82b5858bc7e36b3987fd3ea7e5799f1129d64baae48361c3f15decd274a177206c7c475fd07a823388b08eb98bf
|
7
|
+
data.tar.gz: 3a4cb0aaa9603977f63f0409fd655adbf339c38d29c9193a549cba2f64fc324d740c3c86cdb363093bbaee5e8d2021a9f1a07b0d16d87c79c7a92bceef803ef1
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at milanese.david@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in reisa-wrapper.gemspec
|
4
|
+
gemspec
|
5
|
+
|
6
|
+
group :development do
|
7
|
+
gem 'guard'
|
8
|
+
gem 'guard-rspec' , require: false
|
9
|
+
gem 'guard-bundler' , require: false
|
10
|
+
end
|
11
|
+
|
12
|
+
group :test do
|
13
|
+
gem 'webmock'
|
14
|
+
gem 'vcr'
|
15
|
+
gem 'byebug'
|
16
|
+
end
|
17
|
+
|
18
|
+
group :development, :test do
|
19
|
+
gem 'awesome_print', require: 'ap'
|
20
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
reiformslive-ruby (0.1.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
addressable (2.5.1)
|
10
|
+
public_suffix (~> 2.0, >= 2.0.2)
|
11
|
+
awesome_print (1.8.0)
|
12
|
+
byebug (9.0.6)
|
13
|
+
coderay (1.1.1)
|
14
|
+
crack (0.4.3)
|
15
|
+
safe_yaml (~> 1.0.0)
|
16
|
+
diff-lcs (1.3)
|
17
|
+
faraday (0.13.1)
|
18
|
+
multipart-post (>= 1.2, < 3)
|
19
|
+
ffi (1.9.18)
|
20
|
+
formatador (0.2.5)
|
21
|
+
guard (2.14.1)
|
22
|
+
formatador (>= 0.2.4)
|
23
|
+
listen (>= 2.7, < 4.0)
|
24
|
+
lumberjack (~> 1.0)
|
25
|
+
nenv (~> 0.1)
|
26
|
+
notiffany (~> 0.0)
|
27
|
+
pry (>= 0.9.12)
|
28
|
+
shellany (~> 0.0)
|
29
|
+
thor (>= 0.18.1)
|
30
|
+
guard-bundler (2.1.0)
|
31
|
+
bundler (~> 1.0)
|
32
|
+
guard (~> 2.2)
|
33
|
+
guard-compat (~> 1.1)
|
34
|
+
guard-compat (1.2.1)
|
35
|
+
guard-rspec (4.7.3)
|
36
|
+
guard (~> 2.1)
|
37
|
+
guard-compat (~> 1.1)
|
38
|
+
rspec (>= 2.99.0, < 4.0)
|
39
|
+
hashdiff (0.3.4)
|
40
|
+
json (2.1.0)
|
41
|
+
listen (3.1.5)
|
42
|
+
rb-fsevent (~> 0.9, >= 0.9.4)
|
43
|
+
rb-inotify (~> 0.9, >= 0.9.7)
|
44
|
+
ruby_dep (~> 1.2)
|
45
|
+
lumberjack (1.0.12)
|
46
|
+
method_source (0.8.2)
|
47
|
+
multipart-post (2.0.0)
|
48
|
+
nenv (0.3.0)
|
49
|
+
notiffany (0.1.1)
|
50
|
+
nenv (~> 0.1)
|
51
|
+
shellany (~> 0.0)
|
52
|
+
pry (0.10.4)
|
53
|
+
coderay (~> 1.1.0)
|
54
|
+
method_source (~> 0.8.1)
|
55
|
+
slop (~> 3.4)
|
56
|
+
public_suffix (2.0.5)
|
57
|
+
rake (10.5.0)
|
58
|
+
rb-fsevent (0.10.2)
|
59
|
+
rb-inotify (0.9.10)
|
60
|
+
ffi (>= 0.5.0, < 2)
|
61
|
+
rspec (3.6.0)
|
62
|
+
rspec-core (~> 3.6.0)
|
63
|
+
rspec-expectations (~> 3.6.0)
|
64
|
+
rspec-mocks (~> 3.6.0)
|
65
|
+
rspec-core (3.6.0)
|
66
|
+
rspec-support (~> 3.6.0)
|
67
|
+
rspec-expectations (3.6.0)
|
68
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
69
|
+
rspec-support (~> 3.6.0)
|
70
|
+
rspec-mocks (3.6.0)
|
71
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
72
|
+
rspec-support (~> 3.6.0)
|
73
|
+
rspec-support (3.6.0)
|
74
|
+
ruby_dep (1.5.0)
|
75
|
+
safe_yaml (1.0.4)
|
76
|
+
shellany (0.0.1)
|
77
|
+
slop (3.6.0)
|
78
|
+
thor (0.19.4)
|
79
|
+
vcr (3.0.3)
|
80
|
+
webmock (3.0.1)
|
81
|
+
addressable (>= 2.3.6)
|
82
|
+
crack (>= 0.3.2)
|
83
|
+
hashdiff
|
84
|
+
|
85
|
+
PLATFORMS
|
86
|
+
ruby
|
87
|
+
|
88
|
+
DEPENDENCIES
|
89
|
+
awesome_print
|
90
|
+
bundler (~> 1.13)
|
91
|
+
byebug
|
92
|
+
faraday (~> 0.13.1)
|
93
|
+
guard
|
94
|
+
guard-bundler
|
95
|
+
guard-rspec
|
96
|
+
json (~> 2.1.0)
|
97
|
+
rake (~> 10.0)
|
98
|
+
reiformslive-ruby!
|
99
|
+
rspec (~> 3.0)
|
100
|
+
vcr
|
101
|
+
webmock
|
102
|
+
|
103
|
+
BUNDLED WITH
|
104
|
+
1.13.7
|
data/Guardfile
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
## Uncomment and set this to only include directories you want to watch
|
5
|
+
# directories %w(app lib config test spec features) \
|
6
|
+
# .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
|
7
|
+
|
8
|
+
## Note: if you are using the `directories` clause above and you are not
|
9
|
+
## watching the project directory ('.'), then you will want to move
|
10
|
+
## the Guardfile to a watched dir and symlink it back, e.g.
|
11
|
+
#
|
12
|
+
# $ mkdir config
|
13
|
+
# $ mv Guardfile config/
|
14
|
+
# $ ln -s config/Guardfile .
|
15
|
+
#
|
16
|
+
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
17
|
+
|
18
|
+
# Note: The cmd option is now required due to the increasing number of ways
|
19
|
+
# rspec may be run, below are examples of the most common uses.
|
20
|
+
# * bundler: 'bundle exec rspec'
|
21
|
+
# * bundler binstubs: 'bin/rspec'
|
22
|
+
# * spring: 'bin/rspec' (This will use spring if running and you have
|
23
|
+
# installed the spring binstubs per the docs)
|
24
|
+
# * zeus: 'zeus rspec' (requires the server to be started separately)
|
25
|
+
# * 'just' rspec: 'rspec'
|
26
|
+
|
27
|
+
guard :rspec, cmd: "bundle exec rspec" do
|
28
|
+
require "guard/rspec/dsl"
|
29
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
30
|
+
|
31
|
+
# Feel free to open issues for suggestions and improvements
|
32
|
+
|
33
|
+
# RSpec files
|
34
|
+
rspec = dsl.rspec
|
35
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
36
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
37
|
+
watch(rspec.spec_files)
|
38
|
+
|
39
|
+
# Ruby files
|
40
|
+
ruby = dsl.ruby
|
41
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
42
|
+
|
43
|
+
# Rails files
|
44
|
+
rails = dsl.rails(view_extensions: %w(erb haml slim))
|
45
|
+
dsl.watch_spec_files_for(rails.app_files)
|
46
|
+
dsl.watch_spec_files_for(rails.views)
|
47
|
+
|
48
|
+
watch(rails.controllers) do |m|
|
49
|
+
[
|
50
|
+
rspec.spec.call("routing/#{m[1]}_routing"),
|
51
|
+
rspec.spec.call("controllers/#{m[1]}_controller"),
|
52
|
+
rspec.spec.call("acceptance/#{m[1]}")
|
53
|
+
]
|
54
|
+
end
|
55
|
+
|
56
|
+
# Rails config changes
|
57
|
+
watch(rails.spec_helper) { rspec.spec_dir }
|
58
|
+
watch(rails.routes) { "#{rspec.spec_dir}/routing" }
|
59
|
+
watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
|
60
|
+
|
61
|
+
# Capybara features specs
|
62
|
+
watch(rails.view_dirs) { |m| rspec.spec.call("features/#{m[1]}") }
|
63
|
+
watch(rails.layouts) { |m| rspec.spec.call("features/#{m[1]}") }
|
64
|
+
|
65
|
+
# Turnip features and steps
|
66
|
+
watch(%r{^spec/acceptance/(.+)\.feature$})
|
67
|
+
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
|
68
|
+
Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
guard :bundler do
|
73
|
+
require 'guard/bundler'
|
74
|
+
require 'guard/bundler/verify'
|
75
|
+
helper = Guard::Bundler::Verify.new
|
76
|
+
|
77
|
+
files = ['Gemfile']
|
78
|
+
files += Dir['*.gemspec'] if files.any? { |f| helper.uses_gemspec?(f) }
|
79
|
+
|
80
|
+
# Assume files are symlinked from somewhere
|
81
|
+
files.each { |file| watch(helper.real_path(file)) }
|
82
|
+
end
|
data/README.md
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# Reisa::Wrapper
|
2
|
+
|
3
|
+
A ruby wrapper for the REIFormslive developers API.
|
4
|
+
|
5
|
+
See REIFormslive [developers documetaion](http://developer.reiformslive.com.au/docs/index.html) for full details on the API.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'reisa-wrapper'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install reisa-wrapper
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/reisa-wrapper. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "reisa/wrapper"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
module REIformslive
|
2
|
+
class Form
|
3
|
+
PATH = '/forms'.freeze
|
4
|
+
|
5
|
+
attr_reader :data
|
6
|
+
|
7
|
+
def initialize data: {}
|
8
|
+
@data = data
|
9
|
+
end
|
10
|
+
|
11
|
+
def id
|
12
|
+
data['id'].to_i
|
13
|
+
end
|
14
|
+
|
15
|
+
def template_version_id
|
16
|
+
data['template_version_id'].to_i
|
17
|
+
end
|
18
|
+
|
19
|
+
def agency_id
|
20
|
+
data['agency_id'].to_i
|
21
|
+
end
|
22
|
+
|
23
|
+
def user_id
|
24
|
+
data['user_id'].to_i
|
25
|
+
end
|
26
|
+
|
27
|
+
def name
|
28
|
+
data['name']
|
29
|
+
end
|
30
|
+
|
31
|
+
def template?
|
32
|
+
data['template'].to_s == 'true'
|
33
|
+
end
|
34
|
+
|
35
|
+
def finalised?
|
36
|
+
data['finalised'].to_s == 'true'
|
37
|
+
end
|
38
|
+
|
39
|
+
def private?
|
40
|
+
data['private'].to_s == 'true'
|
41
|
+
end
|
42
|
+
|
43
|
+
def created_at
|
44
|
+
Time.at data['created'].to_i
|
45
|
+
end
|
46
|
+
|
47
|
+
def updated_at
|
48
|
+
Time.at data['updated'].to_i
|
49
|
+
end
|
50
|
+
|
51
|
+
def given_name
|
52
|
+
data['given_name']
|
53
|
+
end
|
54
|
+
|
55
|
+
def surname
|
56
|
+
data['surname']
|
57
|
+
end
|
58
|
+
|
59
|
+
def full_name
|
60
|
+
"#{given_name} #{surname}"
|
61
|
+
end
|
62
|
+
|
63
|
+
def template_cost
|
64
|
+
data['template_cost'].to_i
|
65
|
+
end
|
66
|
+
|
67
|
+
def template_id
|
68
|
+
data['template_id'].to_i
|
69
|
+
end
|
70
|
+
|
71
|
+
def template_name
|
72
|
+
data['template_name']
|
73
|
+
end
|
74
|
+
|
75
|
+
def template_code
|
76
|
+
data['template_code']
|
77
|
+
end
|
78
|
+
|
79
|
+
def template_instruction_pages
|
80
|
+
data['template_instruction_pages'].to_i
|
81
|
+
end
|
82
|
+
|
83
|
+
def update data={}, path: "#{PATH}/#{id}/save"
|
84
|
+
REIformslive::Session
|
85
|
+
.put(path: path, data: data)
|
86
|
+
.parse_json['message']
|
87
|
+
.send(:==, 'The form has been saved.')
|
88
|
+
.tap{|ok| @data = self.class.find(id).data if ok }
|
89
|
+
end
|
90
|
+
|
91
|
+
def self.all path: PATH
|
92
|
+
REIformslive::Session
|
93
|
+
.get(path: path)
|
94
|
+
.parse_json
|
95
|
+
.map{|data| self.new data: data }
|
96
|
+
end
|
97
|
+
|
98
|
+
def self.find id, path: "#{PATH}/#{id}"
|
99
|
+
self.new data:
|
100
|
+
REIformslive::Session
|
101
|
+
.get(path: path)
|
102
|
+
.parse_json
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module REIformslive
|
2
|
+
class Session
|
3
|
+
require 'faraday'
|
4
|
+
|
5
|
+
def self.get path: '/'
|
6
|
+
connection
|
7
|
+
.get(path)
|
8
|
+
.body
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.put path: '/', data: {}
|
12
|
+
connection
|
13
|
+
.put(path, data)
|
14
|
+
.body
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.base_url
|
18
|
+
'https://sa-api.staging.reiformslive.com.au'
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.connection
|
22
|
+
conn = Faraday.new base_url
|
23
|
+
conn.basic_auth '4b66ff95-ade7-413e-b086-0044de7b4ccf', 'ae7e5a1b-e85d-43c4-8d01-fd5cb47d7044'
|
24
|
+
conn
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module REIformslive
|
2
|
+
class Template
|
3
|
+
require 'reiformslive/core_ext'
|
4
|
+
|
5
|
+
PATH = '/templates'.freeze
|
6
|
+
|
7
|
+
attr_reader :data, :path
|
8
|
+
|
9
|
+
def initialize data: '{}'
|
10
|
+
@data = data
|
11
|
+
end
|
12
|
+
|
13
|
+
def cost
|
14
|
+
data['cost'].to_i
|
15
|
+
end
|
16
|
+
|
17
|
+
def active
|
18
|
+
data['active']
|
19
|
+
end
|
20
|
+
|
21
|
+
def id
|
22
|
+
data['id'].to_i
|
23
|
+
end
|
24
|
+
|
25
|
+
def name
|
26
|
+
data['name']
|
27
|
+
end
|
28
|
+
|
29
|
+
def code
|
30
|
+
data['code']
|
31
|
+
end
|
32
|
+
|
33
|
+
def template_group_id
|
34
|
+
data['template_group_id'].to_i
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.all
|
38
|
+
REIformslive::Session
|
39
|
+
.get(path: PATH)
|
40
|
+
.parse_json
|
41
|
+
.map{|data| self.new data: data }
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.find id
|
45
|
+
self.new data:
|
46
|
+
REIformslive::Session
|
47
|
+
.get(path: "#{PATH}/#{id}")
|
48
|
+
.parse_json
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
module REIformslive
|
2
|
+
class UserTemplate
|
3
|
+
PATH = '/user-templates'.freeze
|
4
|
+
|
5
|
+
attr_reader :data
|
6
|
+
|
7
|
+
def initialize data: '{}'
|
8
|
+
@data = data
|
9
|
+
end
|
10
|
+
|
11
|
+
def id
|
12
|
+
data['id'].to_i
|
13
|
+
end
|
14
|
+
|
15
|
+
def template_version_id
|
16
|
+
data['template_version_id'].to_i
|
17
|
+
end
|
18
|
+
|
19
|
+
def agency_id
|
20
|
+
data['agency_id'].to_i
|
21
|
+
end
|
22
|
+
|
23
|
+
def user_id
|
24
|
+
data['user_id'].to_i
|
25
|
+
end
|
26
|
+
|
27
|
+
def name
|
28
|
+
data['name']
|
29
|
+
end
|
30
|
+
|
31
|
+
def template?
|
32
|
+
data['template'].to_s == 'true'
|
33
|
+
end
|
34
|
+
|
35
|
+
def finalised?
|
36
|
+
data['finalised'].to_s == 'true'
|
37
|
+
end
|
38
|
+
|
39
|
+
def private?
|
40
|
+
data['private'].to_s == 'true'
|
41
|
+
end
|
42
|
+
|
43
|
+
def created_at
|
44
|
+
Time.at data['created'].to_i
|
45
|
+
end
|
46
|
+
|
47
|
+
def updated_at
|
48
|
+
Time.at data['updated'].to_i
|
49
|
+
end
|
50
|
+
|
51
|
+
def given_name
|
52
|
+
data['given_name']
|
53
|
+
end
|
54
|
+
|
55
|
+
def surname
|
56
|
+
data['surname']
|
57
|
+
end
|
58
|
+
|
59
|
+
def full_name
|
60
|
+
"#{given_name} #{surname}"
|
61
|
+
end
|
62
|
+
|
63
|
+
def template_cost
|
64
|
+
data['template_cost'].to_i
|
65
|
+
end
|
66
|
+
|
67
|
+
def template_id
|
68
|
+
data['template_id'].to_i
|
69
|
+
end
|
70
|
+
|
71
|
+
def original_template_name
|
72
|
+
data['template_name']
|
73
|
+
end
|
74
|
+
|
75
|
+
def original_template_code
|
76
|
+
data['template_code']
|
77
|
+
end
|
78
|
+
|
79
|
+
def self.all
|
80
|
+
REIformslive::Session
|
81
|
+
.get(path: PATH)
|
82
|
+
.parse_json
|
83
|
+
.map{|data| self.new data: data }
|
84
|
+
end
|
85
|
+
|
86
|
+
def self.find id
|
87
|
+
self.new data:
|
88
|
+
REIformslive::Session
|
89
|
+
.get(path: "#{PATH}/#{id}")
|
90
|
+
.parse_json
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'reiformslive/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "reiformslive-ruby"
|
8
|
+
spec.version = REIformslive::VERSION
|
9
|
+
spec.authors = ["David Milanese"]
|
10
|
+
spec.email = ["milanese.david@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{An API wrapper for REISA developers API in ruby}
|
13
|
+
spec.description = %q{An API wrapper for REISA developers API in ruby}
|
14
|
+
spec.homepage = "https://github.com/aussiDavid/reiformslive-ruby"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
|
+
f.match(%r{^(test|spec|features)/})
|
18
|
+
end
|
19
|
+
spec.bindir = "exe"
|
20
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.13"
|
24
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
26
|
+
spec.add_development_dependency "json", "~> 2.1"
|
27
|
+
spec.add_development_dependency "faraday", "~> 0.13.1"
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,129 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: reiformslive-ruby
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- David Milanese
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-08-27 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.13'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.13'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: json
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.1'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2.1'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: faraday
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.13.1
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.13.1
|
83
|
+
description: An API wrapper for REISA developers API in ruby
|
84
|
+
email:
|
85
|
+
- milanese.david@gmail.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- CODE_OF_CONDUCT.md
|
91
|
+
- Gemfile
|
92
|
+
- Gemfile.lock
|
93
|
+
- Guardfile
|
94
|
+
- README.md
|
95
|
+
- Rakefile
|
96
|
+
- bin/console
|
97
|
+
- bin/setup
|
98
|
+
- lib/reiformslive/core_ext.rb
|
99
|
+
- lib/reiformslive/credentials.rb
|
100
|
+
- lib/reiformslive/form.rb
|
101
|
+
- lib/reiformslive/session.rb
|
102
|
+
- lib/reiformslive/template.rb
|
103
|
+
- lib/reiformslive/user_template.rb
|
104
|
+
- lib/reiformslive/version.rb
|
105
|
+
- reiformslive-ruby.gemspec
|
106
|
+
homepage: https://github.com/aussiDavid/reiformslive-ruby
|
107
|
+
licenses: []
|
108
|
+
metadata: {}
|
109
|
+
post_install_message:
|
110
|
+
rdoc_options: []
|
111
|
+
require_paths:
|
112
|
+
- lib
|
113
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
|
+
requirements:
|
120
|
+
- - ">="
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: '0'
|
123
|
+
requirements: []
|
124
|
+
rubyforge_project:
|
125
|
+
rubygems_version: 2.6.10
|
126
|
+
signing_key:
|
127
|
+
specification_version: 4
|
128
|
+
summary: An API wrapper for REISA developers API in ruby
|
129
|
+
test_files: []
|