printaura 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: 282ab36cd4533f1f66d3d708d9a026fef4a2e45e
4
+ data.tar.gz: bc1c46b562d09c2dd2179f00fd6b39c4a177daeb
5
+ SHA512:
6
+ metadata.gz: 71f779164eded37cb1b569b7f1ae86f72d21efb49ba6a0cf04e660a2e3bfee84ffcfb484031dbae9f8d068358484e264494ea6e45816099c3e2c01c3d1716e18
7
+ data.tar.gz: 1b9f8ec6e0e41d9faf92741659f62e718eedc36b22eba96ac2b332cb563b2516c4eb1648d593327d78d011d7f5d2f8db212551774ed0bd3e827cfa006d928796
data/' ADDED
@@ -0,0 +1,11 @@
1
+ require 'httparty'
2
+
3
+ module Printaura
4
+ class Api
5
+ def self.method_missing(m, *args, &block)
6
+ # is it always a post?
7
+ body = {key: Printaura::Config.API_KEY, hash: Printaura::Config.API_HASH}
8
+ puts HTTParty.post("http://www.api.printaura.com/api.php", body: )
9
+ end
10
+ end
11
+ end
data/.gitignore ADDED
@@ -0,0 +1,35 @@
1
+ *.gem
2
+ *.swp
3
+ *.rbc
4
+ /.config
5
+ /coverage/
6
+ /InstalledFiles
7
+ /pkg/
8
+ /spec/reports/
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ ## Specific to RubyMotion:
14
+ .dat*
15
+ .repl_history
16
+ build/
17
+
18
+ ## Documentation cache and generated files:
19
+ /.yardoc/
20
+ /_yardoc/
21
+ /doc/
22
+ /rdoc/
23
+
24
+ ## Environment normalisation:
25
+ /.bundle/
26
+ /lib/bundler/man/
27
+
28
+ # for a library or gem, you might want to ignore these files since the code is
29
+ # intended to run in multiple environments; otherwise, check them in:
30
+ # Gemfile.lock
31
+ # .ruby-version
32
+ # .ruby-gemset
33
+
34
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
35
+ .rvmrc
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in printaura.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,31 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ printaura (0.0.1)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ coderay (1.1.0)
10
+ httparty (0.13.3)
11
+ json (~> 1.8)
12
+ multi_xml (>= 0.5.2)
13
+ json (1.8.2)
14
+ method_source (0.8.2)
15
+ multi_xml (0.5.5)
16
+ pry (0.10.1)
17
+ coderay (~> 1.1.0)
18
+ method_source (~> 0.8.1)
19
+ slop (~> 3.4)
20
+ rake (10.4.2)
21
+ slop (3.6.0)
22
+
23
+ PLATFORMS
24
+ ruby
25
+
26
+ DEPENDENCIES
27
+ bundler (~> 1.7)
28
+ httparty
29
+ printaura!
30
+ pry
31
+ rake (~> 10.0)
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Oren Mazor
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 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,
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 THE
21
+ SOFTWARE.
22
+
data/README.md ADDED
@@ -0,0 +1,18 @@
1
+ # Printaura
2
+
3
+ talk to printaura nicely
4
+
5
+ ## Installation
6
+
7
+ ```ruby
8
+ gem 'printaura'
9
+ ```
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install printaura
18
+
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
data/lib/printaura.rb ADDED
@@ -0,0 +1,22 @@
1
+ require "printaura/version"
2
+ require "printaura/product"
3
+
4
+ module Printaura
5
+ class Config
6
+ def self.API_KEY
7
+ @API_KEY
8
+ end
9
+
10
+ def self.API_HASH
11
+ @API_HASH
12
+ end
13
+
14
+ def self.API_KEY=(key)
15
+ @API_KEY=key
16
+ end
17
+
18
+ def self.API_HASH=(hash)
19
+ @API_HASH=hash
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,19 @@
1
+ require 'httparty'
2
+
3
+ module Printaura
4
+ class Api
5
+ def self.method_missing(m, *args, &block)
6
+ #we only really care about the array options
7
+ options = args.last || {}
8
+
9
+ postparams= options.update({key: Printaura::Config.API_KEY, hash: Printaura::Config.API_HASH, method: m}).map {|k,v| "#{k}=#{v}"}.join("&")
10
+ puts postparams
11
+
12
+ result = JSON.parse(HTTParty.post("http://www.api.printaura.com/api.php", body: postparams))
13
+ puts result
14
+ raise result["message"] unless result["status"]
15
+
16
+ return result
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,21 @@
1
+ require "printaura/api"
2
+
3
+ module Printaura
4
+ class Product
5
+ def self.all
6
+ # do i care?
7
+ Api.viewproducts.each do |prod|
8
+ puts prod
9
+ end
10
+ end
11
+
12
+ def initialize(brand, colors, image_id, price, app_ids, title, product_id, sku, shopify)
13
+ # lol :(
14
+ args = {brand_id: brand, colors: Base64.encode64(colors.to_json), front_print: image_id, title: title, description: "", product_price: price, apps: Base64.encode64(app_ids.to_json), product_id: product_id, sku: sku, storeimages: Base64.encode64({"0"=>{"image_id"=> image_id, "default"=>"1"}}.to_json)}
15
+ if shopify
16
+ args = args.merge(shopify)
17
+ end
18
+ Api.addproduct(args)
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,3 @@
1
+ module Printaura
2
+ VERSION = "0.0.1"
3
+ end
data/printaura.gemspec ADDED
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'printaura/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "printaura"
8
+ spec.version = Printaura::VERSION
9
+ spec.authors = ["oren mazor"]
10
+ spec.email = ["oren.mazor@gmail.com"]
11
+ spec.summary = %q{Basic API for talking to Printaura}
12
+ spec.description = %q{Simple API for talking to Printaura}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.7"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "httparty"
24
+ spec.add_development_dependency "pry"
25
+ end
metadata ADDED
@@ -0,0 +1,112 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: printaura
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - oren mazor
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-04-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: httparty
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: pry
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
+ description: Simple API for talking to Printaura
70
+ email:
71
+ - oren.mazor@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - "'"
77
+ - ".gitignore"
78
+ - Gemfile
79
+ - Gemfile.lock
80
+ - LICENSE
81
+ - README.md
82
+ - Rakefile
83
+ - lib/printaura.rb
84
+ - lib/printaura/api.rb
85
+ - lib/printaura/product.rb
86
+ - lib/printaura/version.rb
87
+ - printaura.gemspec
88
+ homepage: ''
89
+ licenses:
90
+ - MIT
91
+ metadata: {}
92
+ post_install_message:
93
+ rdoc_options: []
94
+ require_paths:
95
+ - lib
96
+ required_ruby_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ required_rubygems_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ requirements: []
107
+ rubyforge_project:
108
+ rubygems_version: 2.2.2
109
+ signing_key:
110
+ specification_version: 4
111
+ summary: Basic API for talking to Printaura
112
+ test_files: []