Class: Envato::MarketResource

Inherits:
Resource
  • Object
show all
Defined in:
lib/envato/resources/market.rb

Instance Attribute Summary

Attributes inherited from Resource

#client

Instance Method Summary collapse

Methods inherited from Resource

#initialize

Constructor Details

This class inherits a constructor from Envato::Resource

Instance Method Details

#categories(site:) ⇒ Object

TODO: move methods to CategoriesResource



10
11
12
13
# File 'lib/envato/resources/market.rb', line 10

def categories(site:)
  resp = get("v1/market/categories:#{site}.json")
  Collection.from_response(resp, key: "categories", type: Category)
end

#categories_3doceanObject



39
40
41
# File 'lib/envato/resources/market.rb', line 39

def categories_3docean
  categories(site: "3docean")
end

#categories_audiojungleObject



31
32
33
# File 'lib/envato/resources/market.rb', line 31

def categories_audiojungle
  categories(site: "audiojungle")
end

#categories_codecanyonObject



23
24
25
# File 'lib/envato/resources/market.rb', line 23

def categories_codecanyon
  categories(site: "codecanyon")
end

#categories_graphicriverObject



35
36
37
# File 'lib/envato/resources/market.rb', line 35

def categories_graphicriver
  categories(site: "graphicriver")
end

#categories_photoduneObject



19
20
21
# File 'lib/envato/resources/market.rb', line 19

def categories_photodune
  categories(site: "photodune")
end

#categories_themeforestObject



15
16
17
# File 'lib/envato/resources/market.rb', line 15

def categories_themeforest
  categories(site: "themeforest")
end

#categories_videohiveObject



27
28
29
# File 'lib/envato/resources/market.rb', line 27

def categories_videohive
  categories(site: "videohive")
end

#collection(id:, page: 1) ⇒ Object



127
128
129
# File 'lib/envato/resources/market.rb', line 127

def collection(id:, page: 1)
  Object.new get("v3/market/catalog/collection?id=#{id}&page=#{page}").body
end

#features(site:) ⇒ Object

TODO: Features.new



44
45
46
# File 'lib/envato/resources/market.rb', line 44

def features(site:)
  Object.new get("v1/market/features:#{site}.json").body
end

#features_3doceanObject



72
73
74
# File 'lib/envato/resources/market.rb', line 72

def features_3docean
  features(site: "3docean")
end

#features_audiojungleObject



64
65
66
# File 'lib/envato/resources/market.rb', line 64

def features_audiojungle
  features(site: "audiojungle")
end

#features_codecanyonObject



56
57
58
# File 'lib/envato/resources/market.rb', line 56

def features_codecanyon
  features(site: "codecanyon")
end

#features_graphicriverObject



68
69
70
# File 'lib/envato/resources/market.rb', line 68

def features_graphicriver
  features(site: "graphicriver")
end

#features_photoduneObject



52
53
54
# File 'lib/envato/resources/market.rb', line 52

def features_photodune
  features(site: "photodune")
end

#features_themeforestObject



48
49
50
# File 'lib/envato/resources/market.rb', line 48

def features_themeforest
  features(site: "themeforest")
end

#features_videohiveObject



60
61
62
# File 'lib/envato/resources/market.rb', line 60

def features_videohive
  features(site: "videohive")
end

#new_files(site:, category:) ⇒ Object

TODO: add themeforest, graphicriver, etc.



109
110
111
112
# File 'lib/envato/resources/market.rb', line 109

def new_files(site:, category:)
  resp = get("v1/market/new-files:#{site},#{category}.json")
  Collection.from_response(resp, key: "new-files", type: Item)
end

#new_files_from_user(username:, site:) ⇒ Object



119
120
121
# File 'lib/envato/resources/market.rb', line 119

def new_files_from_user(username:, site:)
  Object.new get("v1/market/new-files-from-user:#{username},#{site}.json")
end

#new_files_graphicriver(category:) ⇒ Object

TODO: add themeforest, etc.



115
116
117
# File 'lib/envato/resources/market.rb', line 115

def new_files_graphicriver(category:)
  new_files(site: "graphicriver", category: category)
end


76
77
78
# File 'lib/envato/resources/market.rb', line 76

def popular_items(site:)
  Object.new get("v1/market/popular:#{site}.json").body
end


104
105
106
# File 'lib/envato/resources/market.rb', line 104

def popular_items_3docean
  popular_items(site: "3docean")
end


96
97
98
# File 'lib/envato/resources/market.rb', line 96

def popular_items_audiojungle
  popular_items(site: "audiojungle")
end


88
89
90
# File 'lib/envato/resources/market.rb', line 88

def popular_items_codecanyon
  popular_items(site: "codecanyon")
end


100
101
102
# File 'lib/envato/resources/market.rb', line 100

def popular_items_graphicriver
  popular_items(site: "graphicriver")
end


84
85
86
# File 'lib/envato/resources/market.rb', line 84

def popular_items_photodune
  popular_items(site: "photodune")
end


80
81
82
# File 'lib/envato/resources/market.rb', line 80

def popular_items_themeforest
  popular_items(site: "themeforest")
end


92
93
94
# File 'lib/envato/resources/market.rb', line 92

def popular_items_videohive
  popular_items(site: "videohive")
end

#random_new_files(site:) ⇒ Object



123
124
125
# File 'lib/envato/resources/market.rb', line 123

def random_new_files(site:)
  Object.new get("v1/market/random-new-files:#{site}.json")
end

#user(username:) ⇒ Object



5
6
7
# File 'lib/envato/resources/market.rb', line 5

def user(username:)
  Object.new get("v1/market/user:#{username}").body
end