agave-client 0.1.0

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.
Files changed (85) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +12 -0
  3. data/.travis.yml +14 -0
  4. data/CODE_OF_CONDUCT.md +49 -0
  5. data/CONTRIBUTORS.md +34 -0
  6. data/Gemfile +7 -0
  7. data/LICENSE.txt +29 -0
  8. data/README.md +41 -0
  9. data/Rakefile +7 -0
  10. data/agave-client.gemspec +63 -0
  11. data/bin/console +15 -0
  12. data/bin/setup +8 -0
  13. data/exe/agave +10 -0
  14. data/lib/agave.rb +11 -0
  15. data/lib/agave/api_client.rb +97 -0
  16. data/lib/agave/api_error.rb +23 -0
  17. data/lib/agave/cli.rb +93 -0
  18. data/lib/agave/dump/dsl/add_to_data_file.rb +14 -0
  19. data/lib/agave/dump/dsl/create_data_file.rb +14 -0
  20. data/lib/agave/dump/dsl/create_post.rb +33 -0
  21. data/lib/agave/dump/dsl/directory.rb +30 -0
  22. data/lib/agave/dump/dsl/root.rb +37 -0
  23. data/lib/agave/dump/format.rb +28 -0
  24. data/lib/agave/dump/format/json.rb +18 -0
  25. data/lib/agave/dump/format/toml.rb +31 -0
  26. data/lib/agave/dump/format/yaml.rb +55 -0
  27. data/lib/agave/dump/operation/add_to_data_file.rb +41 -0
  28. data/lib/agave/dump/operation/create_data_file.rb +28 -0
  29. data/lib/agave/dump/operation/create_post.rb +34 -0
  30. data/lib/agave/dump/operation/directory.rb +34 -0
  31. data/lib/agave/dump/operation/root.rb +27 -0
  32. data/lib/agave/dump/runner.rb +47 -0
  33. data/lib/agave/dump/ssg_detector.rb +36 -0
  34. data/lib/agave/json_api_deserializer.rb +38 -0
  35. data/lib/agave/json_api_serializer.rb +145 -0
  36. data/lib/agave/local/entities_repo.rb +46 -0
  37. data/lib/agave/local/field_type/boolean.rb +12 -0
  38. data/lib/agave/local/field_type/color.rb +63 -0
  39. data/lib/agave/local/field_type/date.rb +12 -0
  40. data/lib/agave/local/field_type/date_time.rb +12 -0
  41. data/lib/agave/local/field_type/file.rb +65 -0
  42. data/lib/agave/local/field_type/float.rb +12 -0
  43. data/lib/agave/local/field_type/gallery.rb +23 -0
  44. data/lib/agave/local/field_type/global_seo.rb +56 -0
  45. data/lib/agave/local/field_type/image.rb +82 -0
  46. data/lib/agave/local/field_type/integer.rb +12 -0
  47. data/lib/agave/local/field_type/json.rb +13 -0
  48. data/lib/agave/local/field_type/lat_lon.rb +30 -0
  49. data/lib/agave/local/field_type/link.rb +12 -0
  50. data/lib/agave/local/field_type/links.rb +21 -0
  51. data/lib/agave/local/field_type/rich_text.rb +21 -0
  52. data/lib/agave/local/field_type/seo.rb +33 -0
  53. data/lib/agave/local/field_type/slug.rb +12 -0
  54. data/lib/agave/local/field_type/string.rb +12 -0
  55. data/lib/agave/local/field_type/text.rb +12 -0
  56. data/lib/agave/local/field_type/theme.rb +43 -0
  57. data/lib/agave/local/field_type/video.rb +77 -0
  58. data/lib/agave/local/item.rb +179 -0
  59. data/lib/agave/local/items_repo.rb +210 -0
  60. data/lib/agave/local/json_api_entity.rb +78 -0
  61. data/lib/agave/local/loader.rb +60 -0
  62. data/lib/agave/local/site.rb +73 -0
  63. data/lib/agave/paginator.rb +33 -0
  64. data/lib/agave/repo.rb +93 -0
  65. data/lib/agave/site/client.rb +24 -0
  66. data/lib/agave/upload/file.rb +92 -0
  67. data/lib/agave/upload/image.rb +8 -0
  68. data/lib/agave/utils/favicon_tags_builder.rb +85 -0
  69. data/lib/agave/utils/locale_value.rb +15 -0
  70. data/lib/agave/utils/meta_tags/article_modified_time.rb +15 -0
  71. data/lib/agave/utils/meta_tags/article_publisher.rb +18 -0
  72. data/lib/agave/utils/meta_tags/base.rb +55 -0
  73. data/lib/agave/utils/meta_tags/description.rb +24 -0
  74. data/lib/agave/utils/meta_tags/image.rb +35 -0
  75. data/lib/agave/utils/meta_tags/og_locale.rb +15 -0
  76. data/lib/agave/utils/meta_tags/og_site_name.rb +18 -0
  77. data/lib/agave/utils/meta_tags/og_type.rb +18 -0
  78. data/lib/agave/utils/meta_tags/robots.rb +14 -0
  79. data/lib/agave/utils/meta_tags/title.rb +46 -0
  80. data/lib/agave/utils/meta_tags/twitter_card.rb +14 -0
  81. data/lib/agave/utils/meta_tags/twitter_site.rb +18 -0
  82. data/lib/agave/utils/seo_tags_builder.rb +45 -0
  83. data/lib/agave/version.rb +4 -0
  84. data/lib/agave/watch/site_change_watcher.rb +37 -0
  85. metadata +504 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 8eb8677e82586c66b8f5f68be49b2b1df88a5009d4b4fd642e7302e7414cf973
4
+ data.tar.gz: 72a02fc56fa7f710ebbeca0e9012f41626cbe0c891307f2c5027efd14ba4876b
5
+ SHA512:
6
+ metadata.gz: 9c5e5ccd857b69cd2f7ae318cd39806e134939e35c0c083dc2f806062184e2eb87fcf2461268fdfea67c621d12a6b6ec65d8c07b2ea66e71abe8d6a8a1a01284
7
+ data.tar.gz: aa22b59e7e8888856189cbf18d8df4c87e7b83131e3cc96370b52c48d75ddbaceb802ec3b5ea696468fd55db49affebf0bf0ef963106bed4375ec0b80dcfaaff
@@ -0,0 +1,12 @@
1
+ /coverage/
2
+ *.gem
3
+
4
+ .rspec_status
5
+ /.bundle/
6
+ /.config
7
+ /.yardoc
8
+ /.yardoc/
9
+
10
+ /doc/
11
+ /Gemfile.lock
12
+ /.ruby-version
@@ -0,0 +1,14 @@
1
+ language: ruby
2
+
3
+ rvm:
4
+ - 2.3
5
+ - 2.4
6
+ - 2.5
7
+
8
+ script:
9
+ - bundle exec rake
10
+
11
+ before_install: gem install bundler -v 1.16.2
12
+
13
+ install:
14
+ - bundle install
@@ -0,0 +1,49 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, and in the interest of
4
+ fostering an open and welcoming community, we pledge to respect all people who
5
+ contribute through reporting issues, posting feature requests, updating
6
+ documentation, submitting pull requests or patches, and other activities.
7
+
8
+ We are committed to making participation in this project a harassment-free
9
+ experience for everyone, regardless of level of experience, gender, gender
10
+ identity and expression, sexual orientation, disability, personal appearance,
11
+ body size, race, ethnicity, age, religion, or nationality.
12
+
13
+ Examples of unacceptable behavior by participants include:
14
+
15
+ * The use of sexualized language or imagery
16
+ * Personal attacks
17
+ * Trolling or insulting/derogatory comments
18
+ * Public or private harassment
19
+ * Publishing other's private information, such as physical or electronic
20
+ addresses, without explicit permission
21
+ * Other unethical or unprofessional conduct
22
+
23
+ Project maintainers have the right and responsibility to remove, edit, or
24
+ reject comments, commits, code, wiki edits, issues, and other contributions
25
+ that are not aligned to this Code of Conduct, or to ban temporarily or
26
+ permanently any contributor for other behaviors that they deem inappropriate,
27
+ threatening, offensive, or harmful.
28
+
29
+ By adopting this Code of Conduct, project maintainers commit themselves to
30
+ fairly and consistently applying these principles to every aspect of managing
31
+ this project. Project maintainers who do not follow or enforce the Code of
32
+ Conduct may be permanently removed from the project team.
33
+
34
+ This code of conduct applies both within project spaces and in public spaces
35
+ when an individual is representing the project or its community.
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
+ reported by contacting a project maintainer at s.verna@cantierecreativo.net. All
39
+ complaints will be reviewed and investigated and will result in a response that
40
+ is deemed necessary and appropriate to the circumstances. Maintainers are
41
+ obligated to maintain confidentiality with regard to the reporter of an
42
+ incident.
43
+
44
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
45
+ version 1.3.0, available at
46
+ [http://contributor-covenant.org/version/1/3/0/][version]
47
+
48
+ [homepage]: http://contributor-covenant.org
49
+ [version]: http://contributor-covenant.org/version/1/3/0/
@@ -0,0 +1,34 @@
1
+ Agave Contributors
2
+ ============================================
3
+
4
+ * **[Matteo Papadopoulos](https://github.com/spleenteo)
5
+
6
+ * Project Manager
7
+
8
+ * **[Stefano Verna](https://github.com/stefanoverna)
9
+
10
+ * Developer
11
+
12
+ * **[Joe Yates](https://github.com/joeyates)
13
+
14
+ * CTO/Developer
15
+
16
+ * **[Silvio Relli](https://github.com/silviorelli)
17
+
18
+ * Project Manager/Developer
19
+
20
+ * **[Matteo Manzo](https://github.com/matteomanzo)
21
+
22
+ * Developer
23
+
24
+ * **[Domenico Garofoli](https://github.com/sirion1987)
25
+
26
+ * Developer
27
+
28
+ * **[Lorenzo Ponticelli](https://github.com/lorezz)
29
+
30
+ * Developer
31
+
32
+ * **[Damiano Giacomello](https://github.com/damjack)
33
+
34
+ * Developer
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+ source 'https://rubygems.org'
3
+
4
+ # Specify your gem's dependencies in agave-client.gemspec
5
+ gemspec
6
+
7
+ gem 'pry'
@@ -0,0 +1,29 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2018, Developers Italia
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of the copyright holder nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,41 @@
1
+ # Agave Ruby Client
2
+
3
+ | Project | Agave Ruby Client |
4
+ | ---------------------- | ------------ |
5
+ | Gem name | agave-client |
6
+ | License | [BSD 3](https://github.com/cantierecreativo/ruby-agave-client/blob/master/LICENSE) |
7
+ | Version | [![Gem Version](https://badge.fury.io/rb/agave-client.svg)](http://badge.fury.io/rb/agave-client) |
8
+ | Continuous integration | [![Build Status](https://secure.travis-ci.org/cantierecreativo/ruby-agave-client.svg?branch=master)](https://travis-ci.org/cantierecreativo/ruby-agave-client) |
9
+ | Test coverate | [![Coverage Status](https://coveralls.io/repos/github/cantierecreativo/ruby-agave-client/badge.svg?branch=master)](https://coveralls.io/github/cantierecreativo/ruby-agave-client?branch=master) |
10
+ | Credits | [Contributors](https://github.com/cantierecreativo/ruby-agave-client/graphs/contributors) |
11
+
12
+ CLI tool for AgaveCMS (https://github.com/cantierecreativo/agavecms).
13
+
14
+ ## How to run tests
15
+
16
+ Tests are run against a local copy of Agave running on port 3001.
17
+
18
+ The tests rely on the followoing seed data:
19
+
20
+ * an AccessToken `AGAVE_API_TOKEN`,
21
+ * a User associated with that AccessToken.
22
+
23
+ If you clean `spec/fixtures/vcr_cassettes`, to test the application you must run rspec with these enviroinments variables: `AGAVECMS_BASE_URL=http://agave.lvh.me:3001 AGAVE_API_TOKEN=rwtoken rspec`.
24
+
25
+ ## Development
26
+
27
+ 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.
28
+
29
+ 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).
30
+
31
+ ## Contributing
32
+
33
+ Bug reports and pull requests are welcome on GitHub at https://github.com/cantierecreativo/ruby-agave-client. 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.
34
+
35
+ ## License
36
+
37
+ The gem is available as open source under the terms of the [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause).
38
+
39
+ # Credits
40
+
41
+ Progetto sviluppato e mantenuto da [Cantiere Creativo <img src="https://www.cantierecreativo.net/images/illustrations/logo-07f378ea.svg"/>](https://www.cantierecreativo.net) per conto di [Developers Italia](https://developers.italia.it/)
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+ task default: :spec
@@ -0,0 +1,63 @@
1
+ # coding: utf-8
2
+ # frozen_string_literal: true
3
+
4
+ lib = File.expand_path('../lib', __FILE__)
5
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
6
+ require 'agave/version'
7
+
8
+ Gem::Specification.new do |spec|
9
+ spec.name = 'agave-client'
10
+ spec.version = Agave::VERSION
11
+ spec.authors = [
12
+ 'Stefano Verna',
13
+ 'Joe Yates',
14
+ 'Domenico Garofoli',
15
+ 'Damiano Giacomello',
16
+ 'Silvio Relli',
17
+ 'Lorenzo Ponticelli'
18
+ ]
19
+ spec.email = [
20
+ 's.verna@cantierecreativo.net',
21
+ 'j.yates@cantierecreativo.net',
22
+ 'd.garofoli@cantierecreativo.net',
23
+ 'd.giacomello@cantierecreativo.net',
24
+ 's.relli@cantierecreativo.net',
25
+ 'l.ponticelli@cantierecreativo.net'
26
+ ]
27
+
28
+ spec.summary = 'Ruby client per AgaveCMS API'
29
+ spec.description = 'Ruby client per integrazione con AgaveCMS e jekyll'
30
+ spec.homepage = 'https://github.com/cantierecreativo/ruby-agave-client'
31
+ spec.license = 'BSD-3-Clause'
32
+
33
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|build|spec|features)/}) }
34
+ spec.bindir = 'exe'
35
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
36
+ spec.require_paths = ['lib']
37
+
38
+ spec.add_development_dependency 'bundler', '~> 1.16'
39
+ spec.add_development_dependency 'rake', '~> 10.0'
40
+ spec.add_development_dependency 'rspec', '~> 3.0'
41
+ spec.add_development_dependency 'rubyzip', '~> 0'
42
+ spec.add_development_dependency 'simplecov', '~> 0'
43
+ spec.add_development_dependency 'vcr', '~> 0'
44
+ spec.add_development_dependency 'webmock', '~> 3.4', '>= 3.4.2'
45
+ spec.add_development_dependency 'rubocop', '0.57.2'
46
+ spec.add_development_dependency 'diff_dirs', '~> 0'
47
+ spec.add_development_dependency 'coveralls', '~> 0'
48
+
49
+ spec.add_runtime_dependency 'faraday', '~> 0.9', '>= 0.9.0'
50
+ spec.add_runtime_dependency 'faraday_middleware', '~> 0.9', '>= 0.9.0'
51
+ spec.add_runtime_dependency 'activesupport', '~> 4.2', '>= 4.2.7'
52
+ spec.add_runtime_dependency 'fastimage', '~> 0'
53
+ spec.add_runtime_dependency 'downloadr', '~> 0'
54
+ spec.add_runtime_dependency 'addressable', '~> 0'
55
+ spec.add_runtime_dependency 'thor', '~> 0'
56
+ spec.add_runtime_dependency 'imgix', '~> 0.3', '>= 0.3.1'
57
+ spec.add_runtime_dependency 'toml', '~> 0'
58
+ spec.add_runtime_dependency 'cacert', '~> 0'
59
+ spec.add_runtime_dependency 'dotenv', '~> 0'
60
+ spec.add_runtime_dependency 'pusher-client', '~> 0'
61
+ spec.add_runtime_dependency 'listen', '~> 0'
62
+ spec.add_runtime_dependency 'json_schema', '~> 0'
63
+ end
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'agave'
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require 'irb'
15
+ IRB.start
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
5
+
6
+ require 'dotenv'
7
+ Dotenv.load
8
+
9
+ require 'agave'
10
+ Agave::Cli.start(ARGV)
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+ require 'agave/version'
3
+
4
+ require 'agave/site/client'
5
+ require 'agave/local/site'
6
+ require 'agave/cli'
7
+ require 'agave/utils/seo_tags_builder'
8
+ require 'agave/utils/favicon_tags_builder'
9
+
10
+ module Agave
11
+ end
@@ -0,0 +1,97 @@
1
+ require 'faraday'
2
+ require 'faraday_middleware'
3
+ require 'json'
4
+ require 'json_schema'
5
+ require 'active_support/core_ext/hash/indifferent_access'
6
+ require 'active_support/inflector'
7
+
8
+ require 'agave/version'
9
+ require 'agave/repo'
10
+
11
+ require 'agave/api_error'
12
+
13
+ require 'cacert'
14
+
15
+ module Agave
16
+ module ApiClient
17
+ def self.included(base)
18
+ base.extend ClassMethods
19
+
20
+ base.class_eval do
21
+ attr_reader :token, :base_url, :schema, :extra_headers
22
+ end
23
+ end
24
+
25
+ module ClassMethods
26
+ def json_schema(subdomain)
27
+ define_method(:initialize) do |options = {}|
28
+ @token = ENV['AGAVE_API_TOKEN']
29
+ @base_url = options[:base_url] || ENV["AGAVECMS_BASE_URL"]
30
+ @extra_headers = options[:extra_headers] || {}
31
+ end
32
+
33
+ response = Faraday.get(
34
+ "#{ENV["AGAVECMS_BASE_URL"]}/docs/site-api-hyperschema.json"
35
+ )
36
+
37
+ schema = JsonSchema.parse!(JSON.parse(response.body))
38
+ schema.expand_references!
39
+
40
+ schema.definitions.each do |type, schema|
41
+ is_collection = schema.links.select{|x| x.rel === "instances"}.any?
42
+ namespace = is_collection ? type.pluralize : type
43
+
44
+ define_method(namespace) do
45
+ instance_variable_set(
46
+ "@#{namespace}",
47
+ instance_variable_get("@#{namespace}") ||
48
+ Agave::Repo.new(self, type, schema)
49
+ )
50
+ end
51
+ end
52
+ end
53
+ end
54
+
55
+ def request(*args)
56
+ connection.send(*args).body.with_indifferent_access
57
+ rescue Faraday::SSLError => e
58
+ raise e if ENV['SSL_CERT_FILE'] == Cacert.pem
59
+
60
+ Cacert.set_in_env
61
+ request(*args)
62
+ rescue Faraday::ConnectionFailed, Faraday::TimeoutError => e
63
+ puts e.message
64
+ raise e
65
+ rescue Faraday::ClientError => e
66
+ error = ApiError.new(e)
67
+ puts '===='
68
+ puts error.message
69
+ puts '===='
70
+ raise error
71
+ end
72
+
73
+ private
74
+
75
+ def connection
76
+ default_headers = {
77
+ 'Accept' => 'application/json',
78
+ 'Content-Type' => 'application/json',
79
+ 'Authorization' => "Bearer #{@token}",
80
+ 'User-Agent' => "ruby-client v#{Agave::VERSION}",
81
+ 'X-Api-Version' => "2"
82
+ }
83
+
84
+ options = {
85
+ url: base_url + "/api",
86
+ headers: default_headers.merge(extra_headers)
87
+ }
88
+ @connection ||= Faraday.new(options) do |c|
89
+ c.request :json
90
+ c.response :json, content_type: /\bjson$/
91
+ c.response :raise_error
92
+ c.use FaradayMiddleware::FollowRedirects
93
+ c.adapter :net_http
94
+ end
95
+ end
96
+ end
97
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+ module Agave
3
+ class ApiError < StandardError
4
+ attr_reader :faraday_error
5
+
6
+ def initialize(faraday_error)
7
+ @faraday_error = faraday_error
8
+ end
9
+
10
+ def message
11
+ [
12
+ 'AgaveCMS API Error',
13
+ "Status: #{faraday_error.response[:status]}",
14
+ 'Response:',
15
+ JSON.pretty_generate(body)
16
+ ].join("\n")
17
+ end
18
+
19
+ def body
20
+ JSON.parse(faraday_error.response[:body])
21
+ end
22
+ end
23
+ end