fluxx 0.1.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 893d54d2880a1b0349fdca5f899bcad46254f8211a4434a709a1a88c1d98d8ee
4
+ data.tar.gz: 743d20910aa514b140b727f9d297156fa2b96d07632c9f8b26ca4bf863d27782
5
+ SHA512:
6
+ metadata.gz: 613ebe778139badb165cceb6eaa4c8660868bf09aec55ac6802bba0d093349ce77b438ef07a53eebe82c4afe7b0e21b44e50dc0a834de5f0eacfde3394c0c57e
7
+ data.tar.gz: a5b522fb62459f1a3ea37bdeb71622a41699adef4df2a4eca447e14f8528303d0c76b5482c839089d650ad7890b1d51e34accae4e8a4578df3bb8fdeec0f21ff
@@ -0,0 +1,20 @@
1
+ name: CI
2
+
3
+ on: [push]
4
+
5
+ jobs:
6
+ ci:
7
+ runs-on: ubuntu-18.04
8
+
9
+ steps:
10
+ - uses: actions/checkout@master
11
+
12
+ - name: Sets up the environment
13
+ uses: actions/setup-ruby@v1
14
+ with:
15
+ ruby-version: 2.6.x
16
+
17
+ - name: Runs code QA and tests
18
+ env:
19
+ FLUXX_INSTANCE_URL: https://my.preprod.fluxxlabs.com
20
+ run: bundle install && rake
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,54 @@
1
+ require:
2
+ - rubocop-performance
3
+ - rubocop-rspec
4
+
5
+ RSpec:
6
+ Enabled: true
7
+
8
+ Performance:
9
+ Enabled: true
10
+
11
+ Bundler:
12
+ Enabled: true
13
+
14
+ Gemspec:
15
+ Enabled: true
16
+
17
+ Style/StringLiterals:
18
+ Enabled: true
19
+ EnforcedStyle: single_quotes
20
+
21
+ Style/FrozenStringLiteralComment:
22
+ Enabled: false
23
+
24
+ Metrics/LineLength:
25
+ Max: 80
26
+
27
+ Metrics/MethodLength:
28
+ Max: 12
29
+
30
+ Metrics/BlockLength:
31
+ Exclude:
32
+ - 'spec/**/*_spec.rb'
33
+ - '**/*.gemspec'
34
+
35
+ Layout/IndentationConsistency:
36
+ EnforcedStyle: normal
37
+
38
+ Style/BlockDelimiters:
39
+ Enabled: true
40
+
41
+ RSpec/ExampleLength:
42
+ Enabled: false
43
+
44
+ RSpec/MultipleExpectations:
45
+ Enabled: false
46
+
47
+ RSpec/ContextWording:
48
+ Enabled: false
49
+
50
+ Style/MutableConstant:
51
+ Enabled: false
52
+
53
+ Style/WordArray:
54
+ Enabled: false
data/.yardstick.yml ADDED
@@ -0,0 +1,29 @@
1
+ ---
2
+ path: ['lib/**/*.rb']
3
+ threshold: 100
4
+ rules:
5
+ ApiTag::Presence:
6
+ enabled: false
7
+ ApiTag::Inclusion:
8
+ enabled: false
9
+ ApiTag::ProtectedMethod:
10
+ enabled: false
11
+ ApiTag::PrivateMethod:
12
+ enabled: false
13
+ ExampleTag:
14
+ enabled: false
15
+ ReturnTag:
16
+ enabled: true
17
+ exclude: []
18
+ Summary::Presence:
19
+ enabled: true
20
+ exclude: []
21
+ Summary::Length:
22
+ enabled: true
23
+ exclude: []
24
+ Summary::Delimiter:
25
+ enabled: true
26
+ exclude: []
27
+ Summary::SingleLine:
28
+ enabled: true
29
+ exclude: []
@@ -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 stas@nerd.ro. 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,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,101 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ fluxx (0.1.0)
5
+ http-rest_client
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ addressable (2.7.0)
11
+ public_suffix (>= 2.0.2, < 5.0)
12
+ ast (2.4.0)
13
+ crack (0.4.3)
14
+ safe_yaml (~> 1.0.0)
15
+ diff-lcs (1.3)
16
+ docile (1.3.2)
17
+ domain_name (0.5.20190701)
18
+ unf (>= 0.0.5, < 1.0.0)
19
+ ffaker (2.13.0)
20
+ hashdiff (1.0.0)
21
+ http (4.1.1)
22
+ addressable (~> 2.3)
23
+ http-cookie (~> 1.0)
24
+ http-form_data (~> 2.0)
25
+ http_parser.rb (~> 0.6.0)
26
+ http-cookie (1.0.3)
27
+ domain_name (~> 0.5)
28
+ http-form_data (2.1.1)
29
+ http-rest_client (0.1.1)
30
+ http
31
+ http_parser.rb (0.6.0)
32
+ jaro_winkler (1.5.3)
33
+ json (2.2.0)
34
+ parallel (1.18.0)
35
+ parser (2.6.5.0)
36
+ ast (~> 2.4.0)
37
+ public_suffix (4.0.1)
38
+ rainbow (3.0.0)
39
+ rake (12.3.3)
40
+ rspec (3.8.0)
41
+ rspec-core (~> 3.8.0)
42
+ rspec-expectations (~> 3.8.0)
43
+ rspec-mocks (~> 3.8.0)
44
+ rspec-core (3.8.2)
45
+ rspec-support (~> 3.8.0)
46
+ rspec-expectations (3.8.4)
47
+ diff-lcs (>= 1.2.0, < 2.0)
48
+ rspec-support (~> 3.8.0)
49
+ rspec-mocks (3.8.1)
50
+ diff-lcs (>= 1.2.0, < 2.0)
51
+ rspec-support (~> 3.8.0)
52
+ rspec-support (3.8.2)
53
+ rubocop (0.75.0)
54
+ jaro_winkler (~> 1.5.1)
55
+ parallel (~> 1.10)
56
+ parser (>= 2.6)
57
+ rainbow (>= 2.2.2, < 4.0)
58
+ ruby-progressbar (~> 1.7)
59
+ unicode-display_width (>= 1.4.0, < 1.7)
60
+ rubocop-performance (1.5.0)
61
+ rubocop (>= 0.71.0)
62
+ rubocop-rspec (1.36.0)
63
+ rubocop (>= 0.68.1)
64
+ ruby-progressbar (1.10.1)
65
+ safe_yaml (1.0.5)
66
+ simplecov (0.17.1)
67
+ docile (~> 1.1)
68
+ json (>= 1.8, < 3)
69
+ simplecov-html (~> 0.10.0)
70
+ simplecov-html (0.10.2)
71
+ unf (0.1.4)
72
+ unf_ext
73
+ unf_ext (0.0.7.6)
74
+ unicode-display_width (1.6.0)
75
+ vcr (5.0.0)
76
+ webmock (3.7.6)
77
+ addressable (>= 2.3.6)
78
+ crack (>= 0.3.2)
79
+ hashdiff (>= 0.4.0, < 2.0.0)
80
+ yard (0.9.20)
81
+ yardstick (0.9.9)
82
+ yard (~> 0.8, >= 0.8.7.2)
83
+
84
+ PLATFORMS
85
+ ruby
86
+
87
+ DEPENDENCIES
88
+ bundler
89
+ ffaker
90
+ fluxx!
91
+ rake
92
+ rspec
93
+ rubocop-performance
94
+ rubocop-rspec
95
+ simplecov
96
+ vcr
97
+ webmock
98
+ yardstick
99
+
100
+ BUNDLED WITH
101
+ 1.17.2
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 Stas SUȘCOV
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,115 @@
1
+ # Fluxx
2
+
3
+ This a simple SDK for the [Fluxx](https://www.fluxx.io/) V2 API.
4
+
5
+ **At the moment, it's optimized for read-only operations!**
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'fluxx'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install fluxx
22
+
23
+ ## Usage
24
+
25
+ To start using the application we will need the following environment variables:
26
+
27
+ * `FLUXX_CLIENT_ID` - the OAuth client ID (see below hot to get one)
28
+ * `FLUXX_SECRET` - the OAuth client secret (see below hot to get one)
29
+ * `FLUXX_INSTANCE_URL` - the URL of the Fluxx instance, ex:
30
+ `https://my.preprod.fluxxlabs.com`
31
+
32
+ If you need to work with multiple instances, provide these variables through the
33
+ [`Thread.current.thread_variable_set(key, value)`](https://docs.ruby-lang.org/en/2.6.0/Thread.html#method-i-thread_variable_set) and make sure you run separate threads for every instance.
34
+
35
+ With the credentials in place,
36
+ the following models are available through the SDK:
37
+
38
+ * `Fluxx::GrantRequest`
39
+ * `Fluxx::RequestReport`
40
+ * `Fluxx::RequestOrganization`
41
+ * `Fluxx::RequestUser`
42
+ * `Fluxx::RequestTransaction`
43
+ * `Fluxx::Organization`
44
+ * `Fluxx::Program`
45
+ * `Fluxx::SubProgram`
46
+ * `Fluxx::ModelDocument`
47
+ * `Fluxx::User`
48
+
49
+ Any of the models allows the following CRUD methods:
50
+ * `all`
51
+ * `find`
52
+ * `create`
53
+ * `update`
54
+ * `delete`
55
+
56
+ Here's an example on how to fetch all grant requests:
57
+
58
+ ```ruby
59
+ Fluxx::GrantRequest.all(all_core: true, all_dynamic: true)
60
+ ```
61
+
62
+ Or just one record:
63
+ ```ruby
64
+ Fluxx::GrantRequest.find(1, all_core: true, all_dynamic: true)
65
+ ```
66
+
67
+ To request a filtered collection, use the `filter` query parameter with a JSON
68
+ string similar to the ElasticSearch spec.
69
+
70
+ ```ruby
71
+ Fluxx::RequestTransaction.all(
72
+ all_core: true,
73
+ all_dynamic: true,
74
+ filter: { group_type: :and, conditions: [ [:request_id, :eq, 1] ] }.to_json
75
+ )
76
+ ```
77
+
78
+ ### Client ID & Secret
79
+
80
+ To get an OAuth client ID and a secret,
81
+ you will need to access the `/oauth/applications/`
82
+ page of your Fluxx instance.
83
+
84
+ Use the tools provided in the screen to create a new application.
85
+
86
+ Finally, use the ID and the secret as `FLUXX_CLIENT_ID` and the `FLUXX_SECRET`
87
+ environment variables to make the SDK work.
88
+
89
+ Provide the `FLUXX_INSTANCE_URL` environment variable with the full URL to
90
+ your Fluxx instance (ex. `https://<MY INSTANCE NAME>.preprod.fluxxlabs.com`).
91
+
92
+ ## Development
93
+
94
+ To install this gem onto your local machine, run `bundle exec rake install`. To
95
+ release a new version, update the version number in `version.rb`, and then run
96
+ `bundle exec rake release`, which will create a git tag for the version, push
97
+ git commits and tags, and push the `.gem` file to
98
+ [rubygems.org](https://rubygems.org).
99
+
100
+ ## Contributing
101
+
102
+ Bug reports and pull requests are welcome on GitHub at
103
+ https://github.com/impactmapper/fluxx. This project is intended to be a safe,
104
+ welcoming space for collaboration, and contributors are expected to adhere to
105
+ the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
106
+
107
+ ## License
108
+
109
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
110
+
111
+ ## Code of Conduct
112
+
113
+ Everyone interacting in the Fluxx project’s codebases, issue trackers, chat
114
+ rooms and mailing lists is expected to follow the [code of
115
+ conduct](https://github.com/[USERNAME]/fluxx/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,23 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+ require 'rubocop/rake_task'
4
+ require 'yaml'
5
+ require 'yardstick/rake/verify'
6
+
7
+ desc('Documentation stats and measurements')
8
+ task('qa:docs') do
9
+ yaml = YAML.load_file('.yardstick.yml')
10
+ config = Yardstick::Config.coerce(yaml)
11
+ measure = Yardstick.measure(config)
12
+ measure.puts
13
+ coverage = Yardstick.round_percentage(measure.coverage * 100)
14
+ exit(1) if coverage < config.threshold
15
+ end
16
+
17
+ RuboCop::RakeTask.new('qa:code')
18
+
19
+ desc('Run QA tasks')
20
+ task(qa: ['qa:docs', 'qa:code'])
21
+
22
+ RSpec::Core::RakeTask.new(spec: :qa)
23
+ task(default: :spec)
data/fluxx.gemspec ADDED
@@ -0,0 +1,33 @@
1
+ lib = File.expand_path('lib', __dir__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require 'fluxx/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'fluxx'
7
+ spec.version = Fluxx::VERSION
8
+ spec.authors = ['Stas SUȘCOV', 'ImpactMapper Team']
9
+ spec.email = ['stas@nerd.ro']
10
+
11
+ spec.summary = ''
12
+ spec.description = ''
13
+ spec.homepage = 'https://github.com/impactmapper/fluxx'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
17
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec)/}) }
18
+ end
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_dependency 'http-rest_client'
22
+
23
+ spec.add_development_dependency 'bundler'
24
+ spec.add_development_dependency 'ffaker'
25
+ spec.add_development_dependency 'rake'
26
+ spec.add_development_dependency 'rspec'
27
+ spec.add_development_dependency 'rubocop-performance'
28
+ spec.add_development_dependency 'rubocop-rspec'
29
+ spec.add_development_dependency 'simplecov'
30
+ spec.add_development_dependency 'vcr'
31
+ spec.add_development_dependency 'webmock'
32
+ spec.add_development_dependency 'yardstick'
33
+ end
@@ -0,0 +1,41 @@
1
+ require 'http/rest_client'
2
+ require 'ostruct'
3
+
4
+ module Fluxx
5
+ # Base endpoint resources class
6
+ class Resource < OpenStruct
7
+ extend HTTP::RestClient::DSL
8
+ extend HTTP::RestClient::CRUD
9
+
10
+ PAGINATION_FIELDS = [
11
+ 'total_pages',
12
+ 'total_entries',
13
+ 'current_page',
14
+ 'per_page'
15
+ ]
16
+
17
+ endpoint ENV['FLUXX_INSTANCE_URL']
18
+ content_type 'application/json'
19
+
20
+ # Updated request handler with the auto-refreshing token authentication
21
+ #
22
+ # @param payload [Hash] request payload.
23
+ # @return [HTTP::Response] instance.
24
+ def self.request(*args)
25
+ auth("Bearer #{Token.fresh.access_token}") unless self == Token
26
+ super(*args)
27
+ end
28
+
29
+ # Resource constructor wrapper
30
+ #
31
+ # @param payload [Hash] response payload to build a resource.
32
+ # @return [Object] instance or a list of instances.
33
+ def self.objectify(payload)
34
+ filtered = payload.reject { |key, _| PAGINATION_FIELDS.include?(key) }
35
+ data = filtered.values.first if filtered.is_a?(Hash) && filtered.size == 1
36
+ data = data.values.first if data.is_a?(Hash) && data.size == 1
37
+
38
+ super(data || payload)
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,29 @@
1
+ require 'fluxx/resource'
2
+
3
+ # Fluxx lightweight API wrapper
4
+ module Fluxx
5
+ # Core Fluxx API resource mappings.
6
+ CORE_MODELS = {
7
+ GrantRequest: 'grant_request',
8
+ RequestReport: 'request_report',
9
+ RequestOrganization: 'request_organization',
10
+ RequestUser: 'request_user',
11
+ RequestTransaction: 'request_transaction',
12
+ Organization: 'organization',
13
+ Program: 'program',
14
+ SubProgram: 'sub_program',
15
+ ModelDocument: 'model_document',
16
+ User: 'user'
17
+ }
18
+
19
+ # Helper to define the mapped models
20
+ #
21
+ # @return [Class]
22
+ def self.define_model(model_name, api_path)
23
+ new_resource = Class.new(Resource)
24
+ new_resource.path("/api/rest/v2/#{api_path}")
25
+ const_set(model_name, new_resource)
26
+ end
27
+
28
+ CORE_MODELS.each { |k, v| define_model(k, v) }
29
+ end
@@ -0,0 +1,41 @@
1
+ require 'fluxx/resource'
2
+
3
+ module Fluxx
4
+ # API Token handler
5
+ class Token < Resource
6
+ GRANT_TYPE = 'client_credentials'
7
+ EXPIRATION_DELTA = 60
8
+
9
+ path '/oauth/token'
10
+
11
+ # Resource creation helper
12
+ #
13
+ # @param params [Hash] request parameters to pass to the endpoint
14
+ # @return [Object] instance
15
+ def self.create(params = {})
16
+ client_id = Thread.current.thread_variable_get(:FLUXX_CLIENT_ID)
17
+ secret = Thread.current.thread_variable_get(:FLUXX_SECRET)
18
+
19
+ super(params.merge(
20
+ grant_type: GRANT_TYPE,
21
+ client_id: client_id || ENV['FLUXX_CLIENT_ID'],
22
+ client_secret: secret || ENV['FLUXX_SECRET']
23
+ ))
24
+ end
25
+
26
+ # Creates or refreshes a token
27
+ #
28
+ # @return [Fluxx::Token] instance
29
+ def self.fresh
30
+ @token ||= create
31
+ @expires_in ||= 0
32
+
33
+ if Time.now.to_i > @expires_in + @token.expires_in - EXPIRATION_DELTA
34
+ @token = create
35
+ @expires_in = Time.now.to_i
36
+ end
37
+
38
+ @token
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,3 @@
1
+ module Fluxx
2
+ VERSION = '0.1.1'
3
+ end
data/lib/fluxx.rb ADDED
@@ -0,0 +1,3 @@
1
+ require 'fluxx/version'
2
+ require 'fluxx/token'
3
+ require 'fluxx/resources'
@@ -0,0 +1,269 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: "<FLUXX_INSTANCE_URL>/oauth/token"
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"grant_type":"client_credentials","client_id":"<FLUXX_CLIENT_ID>","client_secret":"<FLUXX_SECRET>"}'
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ Connection:
13
+ - close
14
+ Host:
15
+ - my.preprod.fluxxlabs.com
16
+ User-Agent:
17
+ - http.rb/4.1.1
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Cache-Control:
24
+ - no-store
25
+ Content-Type:
26
+ - application/json; charset=utf-8
27
+ Date:
28
+ - Mon, 07 Oct 2019 16:47:37 GMT
29
+ Etag:
30
+ - '"47d782c1dd55081af36f8c26af0af28d"'
31
+ Pragma:
32
+ - no-cache
33
+ Server:
34
+ - Apache
35
+ Status:
36
+ - 200 OK
37
+ Strict-Transport-Security:
38
+ - max-age=631138519; includeSubDomains
39
+ X-Content-Type-Options:
40
+ - nosniff
41
+ X-Download-Options:
42
+ - noopen
43
+ X-Permitted-Cross-Domain-Policies:
44
+ - none
45
+ X-Rack-Cache:
46
+ - invalidate, pass
47
+ X-Request-Id:
48
+ - fc0e4c94e73f4c3f283bd1c9a75bb2f3
49
+ X-Ua-Compatible:
50
+ - IE=Edge,chrome=1
51
+ X-Xss-Protection:
52
+ - 1; mode=block
53
+ Content-Length:
54
+ - '123'
55
+ Connection:
56
+ - Close
57
+ body:
58
+ encoding: UTF-8
59
+ string: '{"access_token":"<AUTH_TOKEN>","token_type":"bearer","expires_in":7200}'
60
+ http_version:
61
+ recorded_at: Mon, 07 Oct 2019 16:47:38 GMT
62
+ - request:
63
+ method: post
64
+ uri: "<FLUXX_INSTANCE_URL>/oauth/token"
65
+ body:
66
+ encoding: UTF-8
67
+ string: '{"grant_type":"client_credentials","client_id":"<FLUXX_CLIENT_ID>","client_secret":"<FLUXX_SECRET>"}'
68
+ headers:
69
+ Content-Type:
70
+ - application/json
71
+ Connection:
72
+ - close
73
+ Host:
74
+ - my.preprod.fluxxlabs.com
75
+ User-Agent:
76
+ - http.rb/4.1.1
77
+ response:
78
+ status:
79
+ code: 200
80
+ message: OK
81
+ headers:
82
+ Cache-Control:
83
+ - no-store
84
+ Content-Type:
85
+ - application/json; charset=utf-8
86
+ Date:
87
+ - Mon, 07 Oct 2019 16:47:38 GMT
88
+ Etag:
89
+ - '"4e6719ff3f221c359c490a224a944aa2"'
90
+ Pragma:
91
+ - no-cache
92
+ Server:
93
+ - Apache
94
+ Status:
95
+ - 200 OK
96
+ Strict-Transport-Security:
97
+ - max-age=631138519; includeSubDomains
98
+ X-Content-Type-Options:
99
+ - nosniff
100
+ X-Download-Options:
101
+ - noopen
102
+ X-Permitted-Cross-Domain-Policies:
103
+ - none
104
+ X-Rack-Cache:
105
+ - invalidate, pass
106
+ X-Request-Id:
107
+ - 4b2752056ad56dd47644b991c0c231a4
108
+ X-Ua-Compatible:
109
+ - IE=Edge,chrome=1
110
+ X-Xss-Protection:
111
+ - 1; mode=block
112
+ Content-Length:
113
+ - '123'
114
+ Connection:
115
+ - Close
116
+ body:
117
+ encoding: UTF-8
118
+ string: '{"access_token":"<AUTH_TOKEN>","token_type":"bearer","expires_in":7200}'
119
+ http_version:
120
+ recorded_at: Mon, 07 Oct 2019 16:47:39 GMT
121
+ - request:
122
+ method: get
123
+ uri: "<FLUXX_INSTANCE_URL>/api/rest/v2/grant_request?all_core=true&all_dynamic=true&per_page=1"
124
+ body:
125
+ encoding: UTF-8
126
+ string: ''
127
+ headers:
128
+ Authorization:
129
+ - Bearer <AUTH_TOKEN>
130
+ Connection:
131
+ - close
132
+ Host:
133
+ - my.preprod.fluxxlabs.com
134
+ User-Agent:
135
+ - http.rb/4.1.1
136
+ response:
137
+ status:
138
+ code: 200
139
+ message: OK
140
+ headers:
141
+ Cache-Control:
142
+ - must-revalidate, no-cache, no-store, private, max-age=0
143
+ Content-Security-Policy:
144
+ - default-src * 'unsafe-inline' 'unsafe-eval'; frame-ancestors https://gs.stage.fluxxlabs.com
145
+ Content-Type:
146
+ - application/json; charset=utf-8
147
+ Date:
148
+ - Mon, 07 Oct 2019 16:47:39 GMT
149
+ Server:
150
+ - Apache
151
+ Status:
152
+ - 200 OK
153
+ Strict-Transport-Security:
154
+ - max-age=631138519; includeSubDomains
155
+ X-Content-Type-Options:
156
+ - nosniff
157
+ X-Download-Options:
158
+ - noopen
159
+ X-Frame-Options:
160
+ - SAMEORIGIN
161
+ X-Permitted-Cross-Domain-Policies:
162
+ - none
163
+ X-Rack-Cache:
164
+ - miss
165
+ X-Request-Id:
166
+ - 9d2808ac25f6669d8a32cabfc6cbffe2
167
+ X-Ua-Compatible:
168
+ - IE=Edge,chrome=1
169
+ X-Xss-Protection:
170
+ - 1; mode=block
171
+ Content-Length:
172
+ - '2809'
173
+ Connection:
174
+ - Close
175
+ body:
176
+ encoding: UTF-8
177
+ string: |
178
+ {
179
+ "records":{
180
+ "grant_request":[
181
+ {
182
+ "id":1,
183
+ "created_at":"2007-02-16T00:00:00Z",
184
+ "updated_at":"2019-04-25T01:18:54Z",
185
+ "created_by_id":9238,
186
+ "updated_by_id":9215,
187
+ "program_id":2,
188
+ "sub_program_id":2,
189
+ "granted":0,
190
+ "request_received_at":"2006-12-27T00:00:00Z",
191
+ "grant_approved_at":"2007-02-16T00:00:00Z",
192
+ "grant_agreement_at":"2007-02-16T00:00:00Z",
193
+ "grant_closed_at":"2007-02-16T00:00:00Z",
194
+ "amount_requested":0.0,
195
+ "amount_recommended":0.0,
196
+ "duration_in_months":0,
197
+ "project_summary":"SDGs are complicated, hence this project.",
198
+ "base_request_id":"10",
199
+ "ierf_proposed_end_at":"2007-02-16T00:00:00Z",
200
+ "state":"declined",
201
+ "program_lead_id":9193,
202
+ "grantee_signatory_id":9,
203
+ "grantee_org_owner_id":9,
204
+ "display_warnings":1,
205
+ "migrate_id":"10",
206
+ "skip_hgrant_flag":0,
207
+ "contig_id":"1",
208
+ "fx_spotrate_1":0,
209
+ "fx_spotrate_2":0,
210
+ "spending_year":"2007",
211
+ "amount_requested_local":0.0,
212
+ "amount_recommended_local":0.0,
213
+ "related_user1_id":9,
214
+ "is_grantee_a_person":0,
215
+ "donated_amount":0.0,
216
+ "request_type_identifier":"request",
217
+ "gs_grant_ends_at":"2007-02-16T00:00:00Z",
218
+ "gs_project_name":"A book about SDG",
219
+ "use_custom_fx_rate":0,
220
+ "model_theme_id":1,
221
+ "fluxx_theme_code":"GA/SJ Grants",
222
+ "fluxx_program_code":[
223
+ "Institutional Grantmaking",
224
+ "Institutional Grantmaking||Other"
225
+ ],
226
+ "fluxx_budget_code":[
227
+ "Special Opportunities",
228
+ "Special Opportunities||General (Historic Records Only)"
229
+ ],
230
+ "type_of_support_attribute":"Project",
231
+ "po_attribute":"Stas S",
232
+ "entity_attribute":"My Foundation",
233
+ "cycle_attribute":"SP07",
234
+ "gifts_request_status":"Contributions||LOI Declined",
235
+ "gifts_reference_number":"10010",
236
+ "gifts_id_number":"10",
237
+ "project_title":"A book about SDG",
238
+ "calc_total_other_funding":0.0,
239
+ "rollup_calc_sj_rfc_review_total_score":0,
240
+ "rollup_review_count":0,
241
+ "weighted_review_score":0,
242
+ "rollup_calc_sj_review_relevance_rfc_priorities":0,
243
+ "rollup_calc_sj_review_governance_funding_decisions_weighted":0,
244
+ "rollup_calc_sj_review_proposed_work":0,
245
+ "rollup_calc_sj_review_relevant_experience":0,
246
+ "rollup_calc_sj_review_relevant_experience_weighted_2":0,
247
+ "rollup_calc_sj_review_proposed_work_weighted_2":0,
248
+ "rollup_calc_sj_review_relevance_rfc_priorities_weighted_1":0,
249
+ "rollup_calc_total_sj_review_proposed_work":0,
250
+ "rollup_calc_total_sj_review_governance_funding_decisions":0,
251
+ "rollup_calc_total_sj_review_relevance_rfc_priorities":0,
252
+ "rollup_calc_total_sj_review_relevant_experience":0,
253
+ "calc_weighted_sj_review_relevant_experience":0,
254
+ "calc_weighted_sj_review_relevance_rfc_priorities":0,
255
+ "calc_weighted_sj_review_governance_funding_decisions":0,
256
+ "calc_weighted_sj_review_proposed_work_weighted":0,
257
+ "fip_projected_end_at":"2007-02-16T00:00:00Z",
258
+ "secondary_program_lead_id":null
259
+ }
260
+ ]
261
+ },
262
+ "total_pages": 2,
263
+ "total_entries": 2,
264
+ "current_page":1,
265
+ "per_page":1
266
+ }
267
+ http_version:
268
+ recorded_at: Mon, 07 Oct 2019 16:47:40 GMT
269
+ recorded_with: VCR 5.0.0
metadata ADDED
@@ -0,0 +1,216 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fluxx
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Stas SUȘCOV
8
+ - ImpactMapper Team
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2019-10-08 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: http-rest_client
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: '0'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: bundler
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: ffaker
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: rake
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: rspec
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ - !ruby/object:Gem::Dependency
85
+ name: rubocop-performance
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ - !ruby/object:Gem::Dependency
99
+ name: rubocop-rspec
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ type: :development
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ - !ruby/object:Gem::Dependency
113
+ name: simplecov
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ type: :development
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: vcr
128
+ requirement: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ type: :development
134
+ prerelease: false
135
+ version_requirements: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
140
+ - !ruby/object:Gem::Dependency
141
+ name: webmock
142
+ requirement: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ type: :development
148
+ prerelease: false
149
+ version_requirements: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - ">="
152
+ - !ruby/object:Gem::Version
153
+ version: '0'
154
+ - !ruby/object:Gem::Dependency
155
+ name: yardstick
156
+ requirement: !ruby/object:Gem::Requirement
157
+ requirements:
158
+ - - ">="
159
+ - !ruby/object:Gem::Version
160
+ version: '0'
161
+ type: :development
162
+ prerelease: false
163
+ version_requirements: !ruby/object:Gem::Requirement
164
+ requirements:
165
+ - - ">="
166
+ - !ruby/object:Gem::Version
167
+ version: '0'
168
+ description: ''
169
+ email:
170
+ - stas@nerd.ro
171
+ executables: []
172
+ extensions: []
173
+ extra_rdoc_files: []
174
+ files:
175
+ - ".github/workflows/ci.yml"
176
+ - ".gitignore"
177
+ - ".rspec"
178
+ - ".rubocop.yml"
179
+ - ".yardstick.yml"
180
+ - CODE_OF_CONDUCT.md
181
+ - Gemfile
182
+ - Gemfile.lock
183
+ - LICENSE.txt
184
+ - README.md
185
+ - Rakefile
186
+ - fluxx.gemspec
187
+ - lib/fluxx.rb
188
+ - lib/fluxx/resource.rb
189
+ - lib/fluxx/resources.rb
190
+ - lib/fluxx/token.rb
191
+ - lib/fluxx/version.rb
192
+ - vcr_cassettes/fluxx.yml
193
+ homepage: https://github.com/impactmapper/fluxx
194
+ licenses:
195
+ - MIT
196
+ metadata: {}
197
+ post_install_message:
198
+ rdoc_options: []
199
+ require_paths:
200
+ - lib
201
+ required_ruby_version: !ruby/object:Gem::Requirement
202
+ requirements:
203
+ - - ">="
204
+ - !ruby/object:Gem::Version
205
+ version: '0'
206
+ required_rubygems_version: !ruby/object:Gem::Requirement
207
+ requirements:
208
+ - - ">="
209
+ - !ruby/object:Gem::Version
210
+ version: '0'
211
+ requirements: []
212
+ rubygems_version: 3.0.1
213
+ signing_key:
214
+ specification_version: 4
215
+ summary: ''
216
+ test_files: []