moreapp-api 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5e876042f84e7de3abf8ca9914852c6a6d89ac28
4
+ data.tar.gz: d9bfacffc774f686764ac970d8b8f4aa581b2bad
5
+ SHA512:
6
+ metadata.gz: 8a048061a61b7296f9310b149cca7ddac29debc078e66807c283b16902fe943750637d980c37eab567d83ed449bf3d21d6faf7926d73734a184b20648d44587e
7
+ data.tar.gz: 44efe0be9cc4fd44e8ab48870fd8bc4d6406c1a968ddca6cffc65495b65b875bd837a7de7acb972103e071e6f4ca18cafc1f9445798e1d54b87956737de0bf5f
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
@@ -0,0 +1,46 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ ## Our Standards
8
+
9
+ Examples of behavior that contributes to creating a positive environment include:
10
+
11
+ * Using welcoming and inclusive language
12
+ * Being respectful of differing viewpoints and experiences
13
+ * Gracefully accepting constructive criticism
14
+ * Focusing on what is best for the community
15
+ * Showing empathy towards other community members
16
+
17
+ Examples of unacceptable behavior by participants include:
18
+
19
+ * The use of sexualized language or imagery and unwelcome sexual attention or advances
20
+ * Trolling, insulting/derogatory comments, and personal or political attacks
21
+ * Public or private harassment
22
+ * Publishing others' private information, such as a physical or electronic address, without explicit permission
23
+ * Other conduct which could reasonably be considered inappropriate in a professional setting
24
+
25
+ ## Our Responsibilities
26
+
27
+ Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28
+
29
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30
+
31
+ ## Scope
32
+
33
+ This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34
+
35
+ ## Enforcement
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at nathan(at)dixis.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38
+
39
+ Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40
+
41
+ ## Attribution
42
+
43
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
44
+
45
+ [homepage]: http://contributor-covenant.org
46
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,19 @@
1
+ source "https://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ gem 'oauth'
7
+ gem 'json'
8
+
9
+
10
+ # Add dependencies to develop your gem here.
11
+ # Include everything needed to run rake, tests, features, etc.
12
+ group :development do
13
+ gem "rspec", "~> 3.5.0"
14
+ gem "shoulda", ">= 0"
15
+ gem "rdoc", "~> 3.12"
16
+ gem "bundler", "> 1.0"
17
+ gem "juwelier", "~> 2.1.0"
18
+ gem "simplecov", ">= 0"
19
+ end
@@ -0,0 +1,104 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ activesupport (5.2.2)
5
+ concurrent-ruby (~> 1.0, >= 1.0.2)
6
+ i18n (>= 0.7, < 2)
7
+ minitest (~> 5.1)
8
+ tzinfo (~> 1.1)
9
+ addressable (2.6.0)
10
+ public_suffix (>= 2.0.2, < 4.0)
11
+ builder (3.2.3)
12
+ concurrent-ruby (1.1.4)
13
+ descendants_tracker (0.0.4)
14
+ thread_safe (~> 0.3, >= 0.3.1)
15
+ diff-lcs (1.3)
16
+ docile (1.3.1)
17
+ faraday (0.15.4)
18
+ multipart-post (>= 1.2, < 3)
19
+ git (1.5.0)
20
+ github_api (0.18.2)
21
+ addressable (~> 2.4)
22
+ descendants_tracker (~> 0.0.4)
23
+ faraday (~> 0.8)
24
+ hashie (~> 3.5, >= 3.5.2)
25
+ oauth2 (~> 1.0)
26
+ hashie (3.6.0)
27
+ highline (2.0.1)
28
+ i18n (1.6.0)
29
+ concurrent-ruby (~> 1.0)
30
+ json (1.8.6)
31
+ juwelier (2.1.3)
32
+ builder
33
+ bundler (>= 1.13)
34
+ git (>= 1.2.5)
35
+ github_api
36
+ highline (>= 1.6.15)
37
+ nokogiri (>= 1.5.10)
38
+ rake
39
+ rdoc
40
+ semver
41
+ jwt (2.1.0)
42
+ mini_portile2 (2.4.0)
43
+ minitest (5.11.3)
44
+ multi_json (1.13.1)
45
+ multi_xml (0.6.0)
46
+ multipart-post (2.0.0)
47
+ nokogiri (1.10.1)
48
+ mini_portile2 (~> 2.4.0)
49
+ oauth (0.5.4)
50
+ oauth2 (1.4.1)
51
+ faraday (>= 0.8, < 0.16.0)
52
+ jwt (>= 1.0, < 3.0)
53
+ multi_json (~> 1.3)
54
+ multi_xml (~> 0.5)
55
+ rack (>= 1.2, < 3)
56
+ public_suffix (3.0.3)
57
+ rack (2.0.6)
58
+ rake (12.3.2)
59
+ rdoc (3.12.2)
60
+ json (~> 1.4)
61
+ rspec (3.5.0)
62
+ rspec-core (~> 3.5.0)
63
+ rspec-expectations (~> 3.5.0)
64
+ rspec-mocks (~> 3.5.0)
65
+ rspec-core (3.5.4)
66
+ rspec-support (~> 3.5.0)
67
+ rspec-expectations (3.5.0)
68
+ diff-lcs (>= 1.2.0, < 2.0)
69
+ rspec-support (~> 3.5.0)
70
+ rspec-mocks (3.5.0)
71
+ diff-lcs (>= 1.2.0, < 2.0)
72
+ rspec-support (~> 3.5.0)
73
+ rspec-support (3.5.0)
74
+ semver (1.0.1)
75
+ shoulda (3.6.0)
76
+ shoulda-context (~> 1.0, >= 1.0.1)
77
+ shoulda-matchers (~> 3.0)
78
+ shoulda-context (1.2.2)
79
+ shoulda-matchers (3.1.3)
80
+ activesupport (>= 4.0.0)
81
+ simplecov (0.16.1)
82
+ docile (~> 1.1)
83
+ json (>= 1.8, < 3)
84
+ simplecov-html (~> 0.10.0)
85
+ simplecov-html (0.10.2)
86
+ thread_safe (0.3.6)
87
+ tzinfo (1.2.5)
88
+ thread_safe (~> 0.1)
89
+
90
+ PLATFORMS
91
+ ruby
92
+
93
+ DEPENDENCIES
94
+ bundler (> 1.0)
95
+ json
96
+ juwelier (~> 2.1.0)
97
+ oauth
98
+ rdoc (~> 3.12)
99
+ rspec (~> 3.5.0)
100
+ shoulda
101
+ simplecov
102
+
103
+ BUNDLED WITH
104
+ 2.0.1
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2019 'nathanvda'
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,28 @@
1
+ # moreapp-api
2
+
3
+ > A simple gem to interface with the MoreApp REST API.
4
+
5
+ ## Introduction
6
+
7
+ The [moreapp API documentation](https://docs.moreapp.com/) is pretty good and easy to read. They have some example implementations,
8
+ but at the moment not for ruby.
9
+
10
+ While accessing the API is pretty easy and straightforward using the `OAuth` gem, for some I struggled to get it working at first.
11
+ So hopefully this gem will help future users of the moreapp API at least to get started quicker.
12
+
13
+ For now, the gem's main purpose is to provide a very basic and simple interface to `moreapp`,
14
+ for my own limited interactions/needs.
15
+
16
+
17
+
18
+ ## Todo
19
+
20
+ * add tests :)
21
+ * add more API entries?
22
+ * add better documentation?
23
+
24
+
25
+ ## Copyright
26
+
27
+ Copyright (c) 2019 Nathan Van der Auwera. See LICENSE.txt for further details.
28
+
@@ -0,0 +1,57 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+ require 'juwelier'
14
+ Juwelier::Tasks.new do |gem|
15
+ # gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
16
+ gem.name = "moreapp-api"
17
+ gem.homepage = "http://github.com/nathanvda/moreapp-api"
18
+ gem.license = "MIT"
19
+ gem.summary = %Q{A simple gem to use the moreapp API}
20
+ gem.description = %Q{This gem allows you to connect to the moreapp API to send instructions and retrieve the registrations}
21
+ gem.email = "'nathan@dixis.com'"
22
+ gem.authors = ["'nathanvda'"]
23
+
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Juwelier::RubygemsDotOrgTasks.new
27
+ require 'rake/testtask'
28
+ Rake::TestTask.new(:test) do |test|
29
+ test.libs << 'lib' << 'test'
30
+ test.pattern = 'test/**/test_*.rb'
31
+ test.verbose = true
32
+ end
33
+
34
+ require 'rspec/core'
35
+ require 'rspec/core/rake_task'
36
+ RSpec::Core::RakeTask.new(:spec) do |spec|
37
+ spec.pattern = FileList['spec/**/*_spec.rb']
38
+ end
39
+
40
+ desc "Code coverage detail"
41
+ task :simplecov do
42
+ ENV['COVERAGE'] = "true"
43
+ Rake::Task['spec'].execute
44
+ end
45
+
46
+ task :default => :spec
47
+
48
+
49
+ require 'rdoc/task'
50
+ Rake::RDocTask.new do |rdoc|
51
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
52
+
53
+ rdoc.rdoc_dir = 'rdoc'
54
+ rdoc.title = "moreapp-api #{version}"
55
+ rdoc.rdoc_files.include('README*')
56
+ rdoc.rdoc_files.include('lib/**/*.rb')
57
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
@@ -0,0 +1,10 @@
1
+
2
+
3
+ # copy this file to `config.rb` and
4
+ # fill in your own consumer-key and secret
5
+ #
6
+ # the consumer-key is the email you log on with, and the consumer-secret you
7
+ # can generate on https://docs.moreapp.com/#/api/authentication
8
+
9
+ MY_CONSUMER_KEY = 'your-email@example.com'
10
+ MY_CONSUMER_SECRET = 'xxxxxxxxx'
@@ -0,0 +1,45 @@
1
+
2
+ require_relative '../lib/moreapp_api'
3
+ require_relative 'config'
4
+
5
+ ## use your own keys
6
+ consumer_key = MY_CONSUMER_KEY
7
+ consumer_secret = MY_CONSUMER_SECRET
8
+
9
+
10
+
11
+ moreapp = MoreappAPI.new(consumer_key, consumer_secret)
12
+
13
+ customers = moreapp.customers
14
+
15
+ customer = customers.first
16
+
17
+ puts "Customer = [#{customer.id} - #{customer.name}]"
18
+
19
+
20
+ folders = customer.folders
21
+
22
+ my_folder = folders.first
23
+
24
+ puts "My folder = #{my_folder.id} - #{my_folder.name}"
25
+ puts "My folder RAW = #{my_folder.raw_data.inspect}"
26
+ puts "My folder has forms = #{my_folder.forms.inspect}"
27
+
28
+ my_form = my_folder.forms.first
29
+
30
+ my_registrations = my_form.registrations
31
+
32
+ puts my_registrations.inspect
33
+
34
+
35
+ puts "Post an instruction!"
36
+
37
+ form_data = {
38
+ barcode: "1234567",
39
+ description: "You should visit this place and conduct our survey!",
40
+ }
41
+
42
+ response = my_form.post_instruction("nathanvda@gmail.com", "RELAX! This is only a test!", form_data)
43
+
44
+ puts response.inspect
45
+
@@ -0,0 +1,28 @@
1
+
2
+ require_relative '../lib/moreapp_api'
3
+ require_relative 'config'
4
+
5
+ ## use your own keys
6
+ consumer_key = MY_CONSUMER_KEY
7
+ consumer_secret = MY_CONSUMER_SECRET
8
+
9
+
10
+ moreapp = MoreappAPI.new(consumer_key, consumer_secret)
11
+
12
+ puts "Doing the post of instruction directly, instead of first collecting/exploring the API"
13
+
14
+
15
+ customer_id = '65194'
16
+ folder_id = 'c65194a3FB5D21E179A4206BFD0B902EF0BDD0D'
17
+ form_id = '6e3a2cc33368485ba1323b5c0462adef'
18
+
19
+ form = MoreappAPI::Form.new(moreapp, customer_id, folder_id, form_id )
20
+
21
+ form_data = {
22
+ barcode: "1234567",
23
+ description: "You should visit this place and conduct our survey!",
24
+ }
25
+
26
+ response = form.post_instruction("nathanvda@gmail.com", "RELAX! This is only a test AGAIN!", form_data)
27
+
28
+ puts response.inspect
@@ -0,0 +1,38 @@
1
+ require 'oauth'
2
+ require 'json'
3
+ require_relative 'moreapp_api/customer'
4
+
5
+ class MoreappAPI
6
+
7
+
8
+ DEFAULT_MORE_APP_API_BASE = 'https://api.moreapp.com'
9
+
10
+
11
+ def initialize(consumer_key, consumer_secret)
12
+ @consumer = OAuth::Consumer.new(consumer_key, consumer_secret, {site: MoreappAPI.api_base })
13
+ end
14
+
15
+
16
+ def customers
17
+ response = @consumer.request(:get, '/api/v1.0/customers', nil, {}, {})
18
+
19
+ customers_raw = JSON.parse(response.body)
20
+ customers_raw.map{|x| MoreappAPI::Customer.new(self, x )}
21
+
22
+ end
23
+
24
+
25
+ def request(method, url, data={}, options={})
26
+ @consumer.request(method, url, nil, {}, data, options)
27
+ end
28
+
29
+
30
+ def self.api_base=(other_api_base)
31
+ @@api_base = other_api_base
32
+ end
33
+
34
+ def self.api_base
35
+ @@api_base ||= DEFAULT_MORE_APP_API_BASE
36
+ end
37
+
38
+ end
@@ -0,0 +1,24 @@
1
+ require_relative 'folder'
2
+
3
+ class MoreappAPI
4
+ class Customer
5
+
6
+ attr_accessor :id, :name, :raw_data, :moreapp_api
7
+
8
+ def initialize(moreapp_api, data)
9
+ @moreapp_api = moreapp_api
10
+ @id = data["customerId"]
11
+ @name = data["name"]
12
+
13
+ @raw_data = data
14
+ end
15
+
16
+ def folders
17
+ response = @moreapp_api.request(:get, "/api/v1.0/customers/#{self.id}/folders")
18
+
19
+ folders = JSON.parse(response.body)
20
+ folders.map{|data| MoreappAPI::Folder.new(self, data)}
21
+ end
22
+
23
+ end
24
+ end
@@ -0,0 +1,24 @@
1
+ require_relative 'form'
2
+
3
+ class MoreappAPI
4
+ class Folder
5
+
6
+ attr_accessor :id, :name, :raw_data, :customer
7
+
8
+ def initialize(customer, data)
9
+ @moreapp_api = customer.moreapp_api
10
+ @customer = customer
11
+ @id = data["applicationId"]
12
+ @name = data["name"]
13
+ @form_ids = data["forms"]
14
+ @raw_data = data
15
+ end
16
+
17
+ def forms
18
+ @form_ids.map do |long_form_id|
19
+ MoreappAPI::Form.create_in_folder(self, long_form_id)
20
+ end
21
+ end
22
+
23
+ end
24
+ end
@@ -0,0 +1,64 @@
1
+ require_relative 'registration'
2
+
3
+
4
+ class MoreappAPI
5
+ class Form
6
+
7
+ attr_accessor :id, :name, :raw_data
8
+
9
+
10
+ def initialize(moreapp_api, customer_or_id, folder_or_id, form_id, form_name = "")
11
+ @moreapp_api = moreapp_api
12
+
13
+ if customer_or_id.is_a?(MoreappAPI::Customer)
14
+ @customer = customer_or_id
15
+ @customer_id = @customer.id
16
+ else
17
+ @customer_id = customer_or_id
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
+ @id = form_id
26
+ @name = form_name
27
+ end
28
+
29
+
30
+ def self.create_in_folder(folder, long_id)
31
+ customer = folder.customer
32
+ MoreappAPI::Form.new(customer.moreapp_api, customer, folder, long_id[0..31], long_id[32..-1])
33
+ end
34
+
35
+
36
+ def registrations(page=0, options = {})
37
+ options[:pageSize] ||= 100
38
+ options[:sort] ||= []
39
+ options[:query] ||= []
40
+ response = @moreapp_api.request(:post, "/api/v1.0/customers/#{@customer_id}/folders/#{@folder_id}/forms/#{self.id}/registrations/filter/#{page}",
41
+ { pageSize: options[:pageSize], sort: options[:sort], query: options[:query] }.to_json,
42
+ { 'Content-Type' => 'application/json' } )
43
+
44
+ registrations = JSON.parse(response.body)
45
+ registrations.map{|data| MoreappAPI::Registration.new(self, data)}
46
+ end
47
+
48
+
49
+ def post_instruction(recipients, message, data, options={})
50
+ recipients = recipients.is_a?(String) ? [recipients] : recipients
51
+
52
+ response = @moreapp_api.request(:post, "/api/v1.0/customers/#{@customer_id}/#{@folder_id}/#{self.id}/instructions",
53
+ {
54
+ publishInfo: {type: "IMMEDIATE"},
55
+ recipients: recipients,
56
+ data: data,
57
+ message: message
58
+ }.to_json,
59
+ { 'Content-Type' => 'application/json' } )
60
+ JSON.parse(response.body)
61
+ end
62
+
63
+ end
64
+ end
@@ -0,0 +1,14 @@
1
+ class MoreappAPI
2
+ class Registration
3
+
4
+ attr_accessor :id, :name, :raw_data
5
+
6
+ def initialize(moreapp_api, data)
7
+ @moreapp_api = moreapp_api
8
+ # @id = long_id[0..31]
9
+ # @form_data =
10
+ @raw_data = data
11
+ end
12
+
13
+ end
14
+ end
@@ -0,0 +1,29 @@
1
+ class MoreappAPI
2
+ class RegistrationFile
3
+
4
+
5
+ def initialize(customer)
6
+ @customer = customer
7
+ end
8
+
9
+ def post(filename, content_type = 'image/png')
10
+ # !!! Undocumented more-app API
11
+
12
+ image_data = Base64.encode64(File.open(filename, "rb").read)
13
+
14
+ response = @customer.moreapp_api.request(:post, "/api/v1.0/client/registrations/files/base64", nil, {},
15
+ {
16
+ customerNumber: customer.id,
17
+ base64FileContent: "data:#{content_type};base64," + image_data,
18
+ filename: File.basename(filename)
19
+ }.to_json,
20
+ { 'Content-Type' => 'application/json' } )
21
+
22
+ # returns a body containing the location of the image. Looks something like "gridfs://registrationFiles/#{image_location_id}"
23
+ # which can then be used as a value for a "photo" - field
24
+ response.body
25
+ end
26
+
27
+
28
+ end
29
+ end
@@ -0,0 +1,82 @@
1
+ # Generated by juwelier
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+ # stub: moreapp-api 0.0.1 ruby lib
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = "moreapp-api".freeze
9
+ s.version = "0.0.1"
10
+
11
+ s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
+ s.require_paths = ["lib".freeze]
13
+ s.authors = ["'nathanvda'".freeze]
14
+ s.date = "2019-04-03"
15
+ s.description = "This gem allows you to connect to the moreapp API to send instructions and retrieve the registrations".freeze
16
+ s.email = "'nathan@dixis.com'".freeze
17
+ s.extra_rdoc_files = [
18
+ "LICENSE.txt",
19
+ "README.md"
20
+ ]
21
+ s.files = [
22
+ ".document",
23
+ ".rspec",
24
+ "CODE_OF_CONDUCT.md",
25
+ "Gemfile",
26
+ "Gemfile.lock",
27
+ "LICENSE.txt",
28
+ "README.md",
29
+ "Rakefile",
30
+ "VERSION",
31
+ "examples/config.rb.example",
32
+ "examples/test_moreapp_api.rb",
33
+ "examples/test_post_instruction_to_form.rb",
34
+ "lib/moreapp_api.rb",
35
+ "lib/moreapp_api/customer.rb",
36
+ "lib/moreapp_api/folder.rb",
37
+ "lib/moreapp_api/form.rb",
38
+ "lib/moreapp_api/registration.rb",
39
+ "lib/moreapp_api/registration_file.rb",
40
+ "moreapp-api.gemspec",
41
+ "spec/moreapp_api_spec.rb",
42
+ "spec/spec_helper.rb"
43
+ ]
44
+ s.homepage = "http://github.com/nathanvda/moreapp-api".freeze
45
+ s.licenses = ["MIT".freeze]
46
+ s.rubygems_version = "2.6.14.1".freeze
47
+ s.summary = "A simple gem to use the moreapp API".freeze
48
+
49
+ if s.respond_to? :specification_version then
50
+ s.specification_version = 4
51
+
52
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
53
+ s.add_runtime_dependency(%q<oauth>.freeze, [">= 0"])
54
+ s.add_runtime_dependency(%q<json>.freeze, [">= 0"])
55
+ s.add_development_dependency(%q<rspec>.freeze, ["~> 3.5.0"])
56
+ s.add_development_dependency(%q<shoulda>.freeze, [">= 0"])
57
+ s.add_development_dependency(%q<rdoc>.freeze, ["~> 3.12"])
58
+ s.add_development_dependency(%q<bundler>.freeze, ["> 1.0"])
59
+ s.add_development_dependency(%q<juwelier>.freeze, ["~> 2.1.0"])
60
+ s.add_development_dependency(%q<simplecov>.freeze, [">= 0"])
61
+ else
62
+ s.add_dependency(%q<oauth>.freeze, [">= 0"])
63
+ s.add_dependency(%q<json>.freeze, [">= 0"])
64
+ s.add_dependency(%q<rspec>.freeze, ["~> 3.5.0"])
65
+ s.add_dependency(%q<shoulda>.freeze, [">= 0"])
66
+ s.add_dependency(%q<rdoc>.freeze, ["~> 3.12"])
67
+ s.add_dependency(%q<bundler>.freeze, ["> 1.0"])
68
+ s.add_dependency(%q<juwelier>.freeze, ["~> 2.1.0"])
69
+ s.add_dependency(%q<simplecov>.freeze, [">= 0"])
70
+ end
71
+ else
72
+ s.add_dependency(%q<oauth>.freeze, [">= 0"])
73
+ s.add_dependency(%q<json>.freeze, [">= 0"])
74
+ s.add_dependency(%q<rspec>.freeze, ["~> 3.5.0"])
75
+ s.add_dependency(%q<shoulda>.freeze, [">= 0"])
76
+ s.add_dependency(%q<rdoc>.freeze, ["~> 3.12"])
77
+ s.add_dependency(%q<bundler>.freeze, ["> 1.0"])
78
+ s.add_dependency(%q<juwelier>.freeze, ["~> 2.1.0"])
79
+ s.add_dependency(%q<simplecov>.freeze, [">= 0"])
80
+ end
81
+ end
82
+
@@ -0,0 +1,27 @@
1
+ require 'spec_helper'
2
+ require 'moreapp_api'
3
+
4
+ describe MoreappAPI do
5
+
6
+ context "api_base" do
7
+ context "the default version (without setting it)" do
8
+ before do
9
+ MoreappAPI.api_base = nil
10
+ end
11
+ it "returns the default value" do
12
+ expect(MoreappAPI.api_base).to eq("https://api.moreapp.com")
13
+ end
14
+ end
15
+ context "overriding api-base" do
16
+ before do
17
+ MoreappAPI.api_base = "https://developer.api.moreapp.com"
18
+ end
19
+ it "returns the default value" do
20
+ expect(MoreappAPI.api_base).to eq("https://developer.api.moreapp.com")
21
+ end
22
+ end
23
+ end
24
+
25
+
26
+
27
+ end
@@ -0,0 +1,103 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
4
+ # this file to always be loaded, without a need to explicitly require it in any
5
+ # files.
6
+ #
7
+ # Given that it is always loaded, you are encouraged to keep this file as
8
+ # light-weight as possible. Requiring heavyweight dependencies from this file
9
+ # will add to the boot time of your test suite on EVERY test run, even for an
10
+ # individual file that may not need all of that loaded. Instead, consider making
11
+ # a separate helper file that requires the additional dependencies and performs
12
+ # the additional setup, and require it from the spec files that actually need
13
+ # it.
14
+ #
15
+ # The `.rspec` file also contains a few flags that are not defaults but that
16
+ # users commonly want.
17
+ #
18
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
19
+ RSpec.configure do |config|
20
+ # rspec-expectations config goes here. You can use an alternate
21
+ # assertion/expectation library such as wrong or the stdlib/minitest
22
+ # assertions if you prefer.
23
+ config.expect_with :rspec do |expectations|
24
+ # This option will default to `true` in RSpec 4. It makes the `description`
25
+ # and `failure_message` of custom matchers include text for helper methods
26
+ # defined using `chain`, e.g.:
27
+ # be_bigger_than(2).and_smaller_than(4).description
28
+ # # => "be bigger than 2 and smaller than 4"
29
+ # ...rather than:
30
+ # # => "be bigger than 2"
31
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
32
+ end
33
+
34
+ # rspec-mocks config goes here. You can use an alternate test double
35
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
36
+ config.mock_with :rspec do |mocks|
37
+ # Prevents you from mocking or stubbing a method that does not exist on
38
+ # a real object. This is generally recommended, and will default to
39
+ # `true` in RSpec 4.
40
+ mocks.verify_partial_doubles = true
41
+ end
42
+
43
+ # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
44
+ # have no way to turn it off -- the option exists only for backwards
45
+ # compatibility in RSpec 3). It causes shared context metadata to be
46
+ # inherited by the metadata hash of host groups and examples, rather than
47
+ # triggering implicit auto-inclusion in groups with matching metadata.
48
+ config.shared_context_metadata_behavior = :apply_to_host_groups
49
+
50
+ # The settings below are suggested to provide a good initial experience
51
+ # with RSpec, but feel free to customize to your heart's content.
52
+ =begin
53
+ # This allows you to limit a spec run to individual examples or groups
54
+ # you care about by tagging them with `:focus` metadata. When nothing
55
+ # is tagged with `:focus`, all examples get run. RSpec also provides
56
+ # aliases for `it`, `describe`, and `context` that include `:focus`
57
+ # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
58
+ config.filter_run_when_matching :focus
59
+
60
+ # Allows RSpec to persist some state between runs in order to support
61
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
62
+ # you configure your source control system to ignore this file.
63
+ config.example_status_persistence_file_path = "spec/examples.txt"
64
+
65
+ # Limits the available syntax to the non-monkey patched syntax that is
66
+ # recommended. For more details, see:
67
+ # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
68
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
69
+ # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
70
+ config.disable_monkey_patching!
71
+
72
+ # This setting enables warnings. It's recommended, but in some cases may
73
+ # be too noisy due to issues in dependencies.
74
+ config.warnings = true
75
+
76
+ # Many RSpec users commonly either run the entire suite or an individual
77
+ # file, and it's useful to allow more verbose output when running an
78
+ # individual spec file.
79
+ if config.files_to_run.one?
80
+ # Use the documentation formatter for detailed output,
81
+ # unless a formatter has already been configured
82
+ # (e.g. via a command-line flag).
83
+ config.default_formatter = 'doc'
84
+ end
85
+
86
+ # Print the 10 slowest examples and example groups at the
87
+ # end of the spec run, to help surface which specs are running
88
+ # particularly slow.
89
+ config.profile_examples = 10
90
+
91
+ # Run specs in random order to surface order dependencies. If you find an
92
+ # order dependency and want to debug it, you can fix the order by providing
93
+ # the seed, which is printed after each run.
94
+ # --seed 1234
95
+ config.order = :random
96
+
97
+ # Seed global randomization in this process using the `--seed` CLI option.
98
+ # Setting this allows you to use `--seed` to deterministically reproduce
99
+ # test failures related to randomization by passing the same `--seed` value
100
+ # as the one that triggered the failure.
101
+ Kernel.srand config.seed
102
+ =end
103
+ end
metadata ADDED
@@ -0,0 +1,179 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: moreapp-api
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - "'nathanvda'"
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-04-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: oauth
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: json
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '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.5.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.5.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: shoulda
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rdoc
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.12'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.12'
83
+ - !ruby/object:Gem::Dependency
84
+ name: bundler
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: juwelier
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 2.1.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 2.1.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: simplecov
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ description: This gem allows you to connect to the moreapp API to send instructions
126
+ and retrieve the registrations
127
+ email: "'nathan@dixis.com'"
128
+ executables: []
129
+ extensions: []
130
+ extra_rdoc_files:
131
+ - LICENSE.txt
132
+ - README.md
133
+ files:
134
+ - ".document"
135
+ - ".rspec"
136
+ - CODE_OF_CONDUCT.md
137
+ - Gemfile
138
+ - Gemfile.lock
139
+ - LICENSE.txt
140
+ - README.md
141
+ - Rakefile
142
+ - VERSION
143
+ - examples/config.rb.example
144
+ - examples/test_moreapp_api.rb
145
+ - examples/test_post_instruction_to_form.rb
146
+ - lib/moreapp_api.rb
147
+ - lib/moreapp_api/customer.rb
148
+ - lib/moreapp_api/folder.rb
149
+ - lib/moreapp_api/form.rb
150
+ - lib/moreapp_api/registration.rb
151
+ - lib/moreapp_api/registration_file.rb
152
+ - moreapp-api.gemspec
153
+ - spec/moreapp_api_spec.rb
154
+ - spec/spec_helper.rb
155
+ homepage: http://github.com/nathanvda/moreapp-api
156
+ licenses:
157
+ - MIT
158
+ metadata: {}
159
+ post_install_message:
160
+ rdoc_options: []
161
+ require_paths:
162
+ - lib
163
+ required_ruby_version: !ruby/object:Gem::Requirement
164
+ requirements:
165
+ - - ">="
166
+ - !ruby/object:Gem::Version
167
+ version: '0'
168
+ required_rubygems_version: !ruby/object:Gem::Requirement
169
+ requirements:
170
+ - - ">="
171
+ - !ruby/object:Gem::Version
172
+ version: '0'
173
+ requirements: []
174
+ rubyforge_project:
175
+ rubygems_version: 2.6.14.1
176
+ signing_key:
177
+ specification_version: 4
178
+ summary: A simple gem to use the moreapp API
179
+ test_files: []