trademe 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.
Files changed (3) hide show
  1. checksums.yaml +15 -0
  2. data/lib/trademe.rb +29 -0
  3. metadata +44 -0
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ N2Y1ZjNkNTMyODVjMmExNmNiZDk2ZTUzYjE3ZTE3MDRiNjM0OTViZQ==
5
+ data.tar.gz: !binary |-
6
+ YWVjZjRkMjFlNTY5OTc0ODg2NDQzYzUxYTViN2JjZDAzNzQ5N2IwOA==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ NDdlMjdmMjgxMzA3Y2QzYTMyY2Q3YjM2ZWJlYTI1NTZmY2NlYzRkMmEzM2Ux
10
+ YWI4NjEzMTY3YWM2YmZlN2Y0NmUzOWEyMTQ5MTRkZmU2NmQ3YjAwMDUyODg0
11
+ YzIwZmFmNmUxYWY3MjNmNWU0ZThiZjJlMWFmOTAwMmI0M2ZjY2Y=
12
+ data.tar.gz: !binary |-
13
+ ZGVlNTk4YTUxNzhlNjYzNDllZTdlNWM3OWM5M2M4Y2FhODI2ZjM1YjI3OWE4
14
+ ZTc1ODhiYjA3ZThhZmQ2NjBhMTBkNTA5MjZiMDExZTgxYTlhYThjNzQwMzgw
15
+ OTg0NDhlYjMxZDA2NDA2YWY2NzZmNWFlMjUwOTJlYjQ3MWU0YmQ=
@@ -0,0 +1,29 @@
1
+ require 'open-uri'
2
+ require 'json'
3
+ class Trademe
4
+ def initialize(listing_id)
5
+ @listing = JSON.parse open("http://api.trademe.co.nz/v1/Listings/#{listing_id}.json").read
6
+ end
7
+
8
+ def title
9
+ @listing[:Title]
10
+ end
11
+
12
+ def get_keys
13
+ @listing.keys
14
+ end
15
+
16
+
17
+ ["ListingId", "Title", "Category", "StartPrice", "StartDate",
18
+ "EndDate", "ListingLength", "HasGallery", "AsAt", "CategoryPath",
19
+ "PhotoId", "RegionId", "Region", "Suburb", "ViewCount", "NoteDate",
20
+ "CategoryName", "ReserveState", "Attributes", "IsClassified", "OpenHomes",
21
+ "GeographicLocation", "PriceDisplay", "Member", "Body", "Photos", "AllowsPickups",
22
+ "ShippingOptions", "PaymentOptions", "Agency", "CanAddToCart"]
23
+ .each do |action|
24
+ define_method("#{action}") do
25
+ @listing["#{action}"]
26
+ end
27
+ end
28
+
29
+ end
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: trademe
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - James Watling
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-10-24 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A simple wrapper for the public trademe API
14
+ email: james@watling.co.nz
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/trademe.rb
20
+ homepage: http://rubygems.org/gems/trademe
21
+ licenses:
22
+ - MIT
23
+ metadata: {}
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubyforge_project:
40
+ rubygems_version: 2.2.2
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: Get Trademe Listings!
44
+ test_files: []