pdf_kitchen 0.1.0 → 0.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a0bc6e2928b4179446c04aab314b62287b534fcb0c286dc0510ee03a697f7daf
4
- data.tar.gz: 63aaac28de69a0b387e8d8551fb536131ea8e75f9de1425d6b8f72ada1ce8dd1
3
+ metadata.gz: 0ff8b1e10cee8470d4662cd88af0745d31d8942bfde7fe4b81c9a0f041a4f64b
4
+ data.tar.gz: ef604c95e69a3f91006f18c553e5d840b5b02085d22af46b406097527ecf4061
5
5
  SHA512:
6
- metadata.gz: 57de96e526d1483f433fc21af7dd0f6a3f032a80c26847fdcb4e70a156f2151ef489f7b790534843c77cfaabbb800e45c835be6ae52ac10310e1f1d8d7e452d3
7
- data.tar.gz: 5b8e5c13a3af11c5dcd45b58456f066aa7e074f41a73f4c054d4b0627210224bf7caec79c5011ba913d1701d09b259137726a14123e98beb6ea3a744a18c7070
6
+ metadata.gz: 14e8e5597fab524938c14196baffc01f6dad1d3fe4e40bcc410dedc830699df481df90487a59b4d10ba5ef16c9462affb0c7693c85033aa6bf7fecd137d22da0
7
+ data.tar.gz: 22a4b222ebe1173ca2f6740e83853fd075b77229f79c164d832c9a33dd81f999dfd7bd9a62028cc8208e4d535475eff43e6a8b69a342cdd1851f11db66e6f0b2
data/.DS_Store ADDED
Binary file
data/README.md CHANGED
@@ -1,18 +1,5 @@
1
1
  # PdfKitchen
2
2
 
3
- ## gem作成までの手順
4
-
5
- ```
6
- gem update bundler
7
- ```
8
-
9
-
10
-
11
-
12
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/pdf_kitchen`. To experiment with that code, run `bin/console` for an interactive prompt.
13
-
14
- TODO: Delete this and the text above, and describe your gem
15
-
16
3
  ## Installation
17
4
 
18
5
  Add this line to your application's Gemfile:
@@ -31,14 +18,14 @@ Or install it yourself as:
31
18
 
32
19
  ## Usage
33
20
 
34
- TODO: Write usage instructions here
35
-
36
- ## Development
37
-
38
- After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
39
-
40
- 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).
41
-
42
- ## Contributing
43
-
44
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/pdf_kitchen.
21
+ ```
22
+ PdfKitchen::Api.get({
23
+ filename: "/var/www/html/aaa.pdf",
24
+ access_token: "システムで発行するtoken",
25
+ access_secret_token: "システムで発行するsecret-token",
26
+ data: {
27
+ text1: "aaa"
28
+ ...
29
+ }
30
+ })
31
+ ```
data/lib/pdf_kitchen.rb CHANGED
@@ -1,22 +1,26 @@
1
1
  require "pdf_kitchen/version"
2
2
  require 'net/http'
3
3
  require 'uri'
4
+ require 'json'
4
5
 
5
6
  module PdfKitchen
6
7
  class Error < StandardError; end
7
8
  # Your code goes here...
8
9
  class Api
9
- def self.get(token, secret_token)
10
+ def self.post(filename: "sample.pdf", access_token:, access_secret_token:, data: {})
10
11
  uri = URI.parse('https://dev.pdf.kitchen/app/kitchen/cooking')
11
12
  https = Net::HTTP.new(uri.host, uri.port)
12
13
  https.use_ssl = true
13
14
 
14
15
  req = Net::HTTP::Post.new(uri)
15
16
  req["Content-Type"] = "application/json"
16
- req.basic_auth token, secret_token
17
-
17
+ req.basic_auth access_token, access_secret_token
18
+ req.body = data.to_json
18
19
  res = https.request(req)
19
- puts res.body
20
+
21
+ File.open(filename, "w") do |f|
22
+ f.puts(res.body)
23
+ end
20
24
  end
21
25
  end
22
26
  end
data/pdf_kitchen.gemspec CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
7
7
  spec.name = "pdf_kitchen"
8
8
  spec.version = PdfKitchen::VERSION
9
9
  spec.license = "MIT"
10
- spec.version = "0.1.0"
10
+ spec.version = "0.2.0"
11
11
  spec.authors = ["tanaka"]
12
12
  spec.email = ["tanaka@lilli.co.jp"]
13
13
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pdf_kitchen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - tanaka
@@ -45,6 +45,7 @@ executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
+ - ".DS_Store"
48
49
  - ".gitignore"
49
50
  - Gemfile
50
51
  - Gemfile.lock