pinterest_api 0.0.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
+ SHA1:
3
+ metadata.gz: e9e236cc27e39ff53fbdadac0652921a217137f6
4
+ data.tar.gz: a2f94a82bea551b2214591e3cea3294068a94b22
5
+ SHA512:
6
+ metadata.gz: 6f29bf113c71a34f42153ba8d8eaee1039cb66ee0ed1dfd49b1d397a6054a958a3cf0c2833b8d4d75cf2a3f0ffae2aa18cf917226ba4453c27493d28777999f1
7
+ data.tar.gz: 889030cb4cafeecb7d39b9d8ca90eb7d40ea49b3ced849a8eb7ede18478c7eff874805d358febf5767e5d588560b38231adda3b449fa68dfc55930bdee013072
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ *.gem
2
+ .DS_Store
3
+ .idea
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in qq_client.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,16 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ pinterest_api (0.0.1)
5
+ rest-client (~> 0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ rest-client (0.9.2)
11
+
12
+ PLATFORMS
13
+ ruby
14
+
15
+ DEPENDENCIES
16
+ pinterest_api!
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Daniel Gonzàlez Lareo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ 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, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,81 @@
1
+ # Pinterest API for Ruby
2
+
3
+ This is the first step to build a gem to communicate with the pinterest API.
4
+
5
+ ## Installation
6
+
7
+ Add to your Gemfile:
8
+
9
+ ```ruby
10
+ gem 'pinterest_api'
11
+ ```
12
+
13
+ Then `bundle install`
14
+
15
+ Or install it yourself as:
16
+
17
+ ```bash
18
+ $ gem install pinterest_api
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ Frst of all create a PinterestApi::Client with a access_token provided by pinterest. The you can start getting the info.
24
+
25
+ You must have the uid before. This element is provided during the oauth flow.
26
+
27
+ ```ruby
28
+ # Building the client for this spsecific user
29
+ client = PinterestApi::Client.new(access_token)
30
+
31
+ # Get the user information
32
+ # More info (https://developers.pinterest.com/docs/api/users/)
33
+ user_info = client.me
34
+
35
+ # Get the user boards
36
+ # More info (https://developers.pinterest.com/docs/api/users/)
37
+ boards = client.boards
38
+
39
+ # Create a pin
40
+ # More info (https://developers.pinterest.com/docs/api/pins/)
41
+ params = {
42
+ board,
43
+ note,
44
+ link,
45
+ image,
46
+ image_url,
47
+ image_base64
48
+ }
49
+ client.create_pin(params)
50
+ ```
51
+
52
+ ## Contributing
53
+
54
+ 1. Fork it
55
+ 2. Create your feature branch => `git checkout -b my-new-feature`
56
+ 3. Commit your changes => `git commit -am 'Added some feature'`
57
+ 4. Push to the branch => `git push origin my-new-feature`
58
+ 5. Create new Pull Request
59
+
60
+ ## License
61
+
62
+ The MIT License (MIT)
63
+
64
+ Copyright (c) 2014 Daniel Gonzàlez Lareo
65
+
66
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
67
+ this software and associated documentation files (the "Software"), to deal in
68
+ the Software without restriction, including without limitation the rights to
69
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
70
+ the Software, and to permit persons to whom the Software is furnished to do so,
71
+ subject to the following conditions:
72
+
73
+ The above copyright notice and this permission notice shall be included in all
74
+ copies or substantial portions of the Software.
75
+
76
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
77
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
78
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
79
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
80
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
81
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,2 @@
1
+ require 'pinterest_api/version'
2
+ require 'pinterest_api/client'
@@ -0,0 +1,39 @@
1
+ module PinterestApi
2
+ class Client
3
+ API_URL = 'https://api.pinterest.com/v1/'
4
+
5
+ def initialize(access_token)
6
+ @access_token = access_token
7
+ end
8
+
9
+ def me
10
+ self.get('me/')
11
+ end
12
+
13
+ def create_pin(pin_params)
14
+ self.post('pins/', pin_params)
15
+ end
16
+
17
+ def boards
18
+ self.get('me/boards/')
19
+ end
20
+
21
+ private
22
+
23
+ def get(path, parameters = {})
24
+ parameters.merge!(access_token: @access_token)
25
+ JSON.parse RestClient.get(api_url(path), :params => parameters)
26
+ end
27
+
28
+ def post(path, parameters = {})
29
+ parameters.merge!(access_token: @access_token)
30
+ JSON.parse RestClient.post(api_url(path), parameters)
31
+ end
32
+
33
+ def api_url(path)
34
+ path = path.gsub /^\//, ''
35
+ "#{API_URL}#{path}"
36
+ end
37
+
38
+ end
39
+ end
@@ -0,0 +1,3 @@
1
+ module PinterestApi
2
+ VERSION = '0.0.1'
3
+ end
@@ -0,0 +1,15 @@
1
+ require_relative 'lib/pinterest_api/version'
2
+
3
+ Gem::Specification.new do |s|
4
+ s.authors = ['Daniel Gonzalez']
5
+ s.email = ['danigonza86@gmail.com']
6
+ s.name = 'pinterest_api'
7
+ s.version = PinterestApi::VERSION
8
+ s.summary = 'Pinterest api wrapper'
9
+ s.description = 'A pinterest api wrapper'
10
+ s.files = `git ls-files`.split($\)
11
+ s.require_paths = ['lib']
12
+ s.add_dependency 'rest-client', '~> 0'
13
+ s.homepage = 'http://rubygems.org/gems/pinterest_api'
14
+ s.license = 'MIT'
15
+ end
metadata ADDED
@@ -0,0 +1,67 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pinterest_api
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Daniel Gonzalez
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-10-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rest-client
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
+ description: A pinterest api wrapper
28
+ email:
29
+ - danigonza86@gmail.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - ".gitignore"
35
+ - Gemfile
36
+ - Gemfile.lock
37
+ - LICENSE
38
+ - README.md
39
+ - lib/pinterest_api.rb
40
+ - lib/pinterest_api/client.rb
41
+ - lib/pinterest_api/version.rb
42
+ - pinterest_api.gemspec
43
+ homepage: http://rubygems.org/gems/pinterest_api
44
+ licenses:
45
+ - MIT
46
+ metadata: {}
47
+ post_install_message:
48
+ rdoc_options: []
49
+ require_paths:
50
+ - lib
51
+ required_ruby_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ requirements: []
62
+ rubyforge_project:
63
+ rubygems_version: 2.2.1
64
+ signing_key:
65
+ specification_version: 4
66
+ summary: Pinterest api wrapper
67
+ test_files: []